Handling Multiple WIN32 API Windows

HI I am trying to create an application in a Win32 environment containing more than one window. How can I do it? all the Win32 tutorials on the network that I found showed how to manage a single window. How to create a second window and how do I process messages for both of them together? (I realized that I should have only one message loop)

Thankslot!

Dan

+3
source share
2 answers

Your message loop retrieves and sends messages for all windows created in the current thread.

A simple message loop like this will suffice.

MSG msg;
while(GetMessage(&msg,0,0,0,0)>0)
{
  TranslateMessage(&msg);
  DispatchMessage(&msg);
}

, , CreateWindow (...) , / .

. , , WM_DESTROY WindowProc PostQuitMessage(). PostQuitMessage() , . , . , , , , PostQuitMessage. ( ) , , PostQuitMessage , .

, , , , , IS .

Windows :

  while(GetMessage(&msg,hwnd,0,0,0)...

, . /. , , , , NULL hwnd, , , , - .

+6

, ? , - ( ) .

CreateDialog, DialogBox CreateWindow

wndproc , wndproc .

, - , WinAPI..

+1

Source: https://habr.com/ru/post/1722447/


All Articles