Hello everyone, one question.
In VB6, a project that has 2 Forms
In Form1 there is a button, which shows Form2 with Form2.show
To do this with the API, I need a WNDCLASS class for each form ??
And the message loop, is it the same for the 2 forms??
What would a simple example look like with the CreateWindowEX API?
Thank you!!
Create 2 Forms with the API32
-
- Posts: 393
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: Create 2 Forms with the API32
Here is an example (in German, maybe Google can help you to translate?): https://www.freebasic-portal.de/tutoria ... 4-s11.html
Re: Create 2 Forms with the API32
Thank you Lothar.
I know this website, there are very good examples, but I had not seen this one, I will try it. Best regards
I know this website, there are very good examples, but I had not seen this one, I will try it. Best regards
Re: Create 2 Forms with the API32
Hello Lothar.
I tried the example of the web, and I liked it, but I don't know how to capture messages from non-main windows.
It only captures messages from the main window.
For example, the message WM_MOUSEMOVE
Thank you
I tried the example of the web, and I liked it, but I don't know how to capture messages from non-main windows.
It only captures messages from the main window.
For example, the message WM_MOUSEMOVE
Thank you
-
- Posts: 393
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: Create 2 Forms with the API32
Hello Tolo68,
I have only some basic knowlege of Windows API and do not use it often, only to create some simple controls on one window, so I cannot answer your question. I did not test the code. Maybe you can post your code here so that somebody else can help you?
I have only some basic knowlege of Windows API and do not use it often, only to create some simple controls on one window, so I cannot answer your question. I did not test the code. Maybe you can post your code here so that somebody else can help you?
Re: Create 2 Forms with the API32
@Tolo68,
You only need a single Window class and a single WndProc function for this. You can handle all the messages from both window in that single wndproc. But remember one thing. When, handling WM_DESTROY message, check whether the hWnd parameter is the handle of the main window or not. If it is the handle of the main window, just call PostMessage(0) to close the entire program. Otherwise, just return, Windows will close the secondary window.
You only need a single Window class and a single WndProc function for this. You can handle all the messages from both window in that single wndproc. But remember one thing. When, handling WM_DESTROY message, check whether the hWnd parameter is the handle of the main window or not. If it is the handle of the main window, just call PostMessage(0) to close the entire program. Otherwise, just return, Windows will close the secondary window.
-
- Posts: 393
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: Create 2 Forms with the API32
Here is a nice example by dodicat ("custom message box"): viewtopic.php?t=27725
Another example with multiple windows by bojan.dosen: https://freebasic.net/forum/viewtopic.php?t=20537
Another example with multiple windows by bojan.dosen: https://freebasic.net/forum/viewtopic.php?t=20537