最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

winapi - Source codewhat is the implementation of DefWindowProcW() - Stack Overflow

programmeradmin1浏览0评论

  LRESULT DefWindowProcW(
      [in] HWND   hWnd,
      [in] UINT   Msg,
      [in] WPARAM wParam,
      [in] LPARAM lParam
    );

What is the implementation of DefWindowProcW ?

https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-defwindowprocw

  LRESULT DefWindowProcW(
      [in] HWND   hWnd,
      [in] UINT   Msg,
      [in] WPARAM wParam,
      [in] LPARAM lParam
    );

What is the implementation of DefWindowProcW ?

Share Improve this question edited yesterday marc_s 755k184 gold badges1.4k silver badges1.5k bronze badges asked yesterday qmarsunqmarsun 92 bronze badges 8
  • 1 DefWindowProcW is the default implementation for window classes (including controls). Most of it is undocumented, with a few exceptions (such as WM_CLOSE message processing). It's generally not required to know what it does to use it. – IInspectable Commented yesterday
  • 1 One possilble implementation is given in Wine. What specifically about DefWindowProcW do you want to know? – Raymond Chen Commented yesterday
  • @RaymondChen, Awesome I see the code. let's see if I can use it with own DefWindowProcW(). THanks a lot – qmarsun Commented yesterday
  • @qmarsun you have so many things to learn in windows programming all right, knowing what and why DefWindowProc() does is really time waste. Actually, this function is so old that many new users that would use WinUI won't even know its existance. Windows is not open source and the developer needs not know what's inside the API because there is no way you want to modify it. Even if you do want to modify it, you can't. – Michael Chourdakis Commented yesterday
  • 3 Do not try to implement your own DefWindowProcW. New messages are added all the time, and new parameters are added to existing messages. Your copy of DefWindowProcW won't understand those new messages and will create problems like prevent devices from being removable or break the volume up and down buttons. – Raymond Chen Commented yesterday
 |  Show 3 more comments

1 Answer 1

Reset to default -1
Purpose of DefWindowProcW() is handle the WM_* messages 
There are 260 WM_* are defined in #include <windows.h> 
which you can get when you download "Microsoft Visual Studio Community 2019" 
$ grep "define WM_"  windows.h | wc -l
260
DefWindowProcW() has default implementation of these 260 WM_* (windows messages).
and you can see some of them under https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/win32u/defwnd.c#L2388
发布评论

评论列表(0)

  1. 暂无评论