|
-
January 15th, 2003, 12:08 AM
#1
CreateWindow in win32 dll
Hi,
Can anyone show me an example how to CreateWindow in a win32 dll? Also please show me how you handle the message loop?
thanks.
-
January 15th, 2003, 08:35 AM
#2
in your dll-main @DLL_PROCESS_ATTACH you should start a thread with _beginthreadex() with a function somewhat like threadProc()
in your threadProc() do the following:
- define a WNDCLASS
- register WNDCLASS
- CreateWindow()
- ShowWindow()
- add your messageloop -> while(GetMessage...) at the end of the threadProc()
- your WndProc() should be placed outsid the thread
thats the way i always use ... hope it helps
Last edited by RockNix; January 15th, 2003 at 08:38 AM.
So far ... RockNix
---------------------------------------------
Want some code about Threading,
SerCOM, Subclassing .... ?
Go for it - visit us on:
www.klangwerker.de
---------------------------------------------
-
January 15th, 2003, 09:06 PM
#3
Thanks very much.... it is working now.
-
August 22nd, 2006, 10:59 AM
#4
Re: CreateWindow in win32 dll
Hi!
I'm new on this. Can you give me all the example?
I really need to show a window using an dll.
Thanks,
Sérgio Cardoso
-
August 22nd, 2006, 11:15 AM
#5
Re: CreateWindow in win32 dll
 Originally Posted by scardoso
Hi!
I'm new on this. Can you give me all the example?
I really need to show a window using an dll.
Thanks,
Sérgio Cardoso
Here you go:
http://www.pscode.com/vb/scripts/Sho...10097&lngWId=3
Non-MFC example.
Using .NET 2.0 
-
August 22nd, 2006, 11:24 AM
#6
Re: CreateWindow in win32 dll
Thanks for your help, Gecka.
But i'm using a DLL, so it don't work. Do you have an example with DLL?
Sérgio Cardoso
-
January 24th, 2012, 10:33 PM
#7
Re: CreateWindow in win32 dll
Hi San_Lee,
Is it possible for you to share me with the code for the DLL and also the test exe code. I'm too trying with this item but no result.. Thanx,
-
February 2nd, 2012, 01:13 PM
#8
Re: CreateWindow in win32 dll
I am also interested in this. I don't mean to hijack this thread but: What are the limitations of creating windows from a dll?Can I effectively run an entire multithreaded client application through a dll entry point?
Does my question make no sense? I suck with this stuff.
-
February 3rd, 2012, 01:34 AM
#9
Re: CreateWindow in win32 dll
Well, dll is just a piece of compiled code that dynamically gets loaded into process address space and linked with the process. After that it behaves like any other part of the program. Which naturally means that dll code can do anything the exe code can, including creating threads and windows, and windows in threads of course. 
See the sample in the post. You may completely ignore the semaphore stuff in the sample (sorry, the code's not mine, I just made it runnable.)
Last edited by Igor Vartanov; February 3rd, 2012 at 01:37 AM.
Best regards,
Igor
-
February 3rd, 2012, 10:42 AM
#10
Re: CreateWindow in win32 dll
So I can package a function like winMain into the dll and make it an exportable function? Or would I have an exported function that calls what is essentially in the body of winMain (not a call to winMain itself). Does the DLL need an entry point?
Thanks
-
February 3rd, 2012, 11:40 AM
#11
Re: CreateWindow in win32 dll
So I can package a function like winMain into the dll and make it an exportable function?
You can.
Or would I have an exported function that calls what is essentially in the body of winMain (not a call to winMain itself).
In dll you can have an exported function that registers window class and/or creates window. I thought I already said that above: you can have in dll any code you can have in exe. Exported or not, this affects only way you link it.
Does the DLL need an entry point?
Every code dll must have an entry point. Resource-only dll may not.
Last edited by Igor Vartanov; February 3rd, 2012 at 11:44 AM.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|