maybe lpfnWndProc is the most important parts in a windows program

it is call by windows ,but can i call it myself without using WNDCLASSEX

Posted on 2004-06-09 22:12:45 by bailao
The WndProc is just a procedure like any other and can be called directly from within your program. However, it is only a message handling routine that processes messages sent to a window so there is no real reason to have one without a window. The message queue that passes the messages to the WndProc is set up when the window is created and has no other reason to exist without one. In reality, for most messages when you use SendMessage from within your program, the WndProc is actually called directly and the queue is bypassed. The address of the procedure that is called when SendMessage is executed is specified in the WNDCLASSEX structure so there is no way to have a WndProc without defining it there first.

If you wish to have an application without a window you can do that but no messages will be sent to your application, after all they are not useful outside of that context, and so there is no need for a WndProc. For example you can just define an entry point and call any procedure you want, you are not limited to a WndProc as the only type of Windows application.
Posted on 2004-06-09 23:22:41 by donkey
There isn't really any reason to call WndProc directly - SendMessage/PostMessage/etc are plenty fast, and by doing things "the official way", you avoid any theoretical problems.
Posted on 2004-06-10 08:45:53 by f0dder