What messages are processed by DefWindowProc?

Is there any documentation, what messages are processed by DefWindowProc, and how?

I recently came across WM_SETFONT / WM_GETFONT, which is not being processed, I'm not sure if there is an error in my code or if this is the expected behavior, so I tried the following WinMain:


   WNDCLASSEX wcx =
   {
      sizeof(WNDCLASSEX),
      CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, 
      DefWindowProc,
      0, 0,  // class/wnd extra bytes
      hInstance, 
      0,  
      LoadCursor(0, IDC_ARROW),
      0, 
      0,
      _T("some class"),
      0
   };

   ATOM a = RegisterClassEx(&wcx);
   _ASSERTE(a != 0);

   HWND wnd = CreateWindowEx(0, wcx.lpszClassName, NULL, 
                   WS_POPUP, 0,0,0,0, GetDesktopWindow(), 0, hInstance, 0);
   _ASSERTE(wnd != 0);

   HFONT font = (HFONT) GetStockObject(ANSI_VAR_FONT);
   _ASSERTE(font != 0);

   SendMessage(wnd, WM_SETFONT, (WPARAM) font, 0);
   HFONT font2 = (HFONT) SendMessage(wnd, WM_GETFONT, 0, 0);

   _ASSERTE(font2 == font);  // **FAILS**, font2 is 0
+3
source share
1 answer

As far as I know, no. Each window message is a rare and unique thing that may differ in one of MANY ways. Some messages are expected to be sent, others sent.

proc , - DefXXXWindowProc - DefWindowProc, DefDlgProc, DefMDIChildProc ..

, -.

WM_SETTEXT WM_SETREDRAW - , DefWindowProc WND.

WM_SIZE - - BY DefWindowProc - WM_WINDOWPOSCHANGED.

WM_MOUSExxx , , , GetMessage/PeekMessage .

, DefWindowProc, "" . (WM_ACTIVATE ).

, FALSE ( TRUE), , , SetDlgResult, (WM_CTLCOLOR *), proc , DialogProc LRESULT.

(WM_SYSCOMMAND) , DefWindowProc, ( ..).

.


WM_SET/GETFONT, WM_SETFONT, DefwindowProc , , , . (EDIT, STATIC ..) Dialogs WM_SETFONT WM_GETFONT. , WindowProc .

+5

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


All Articles