Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's up with WndProc? It doesn't seem to be called anywhere!

Status
Not open for further replies.

EGDEric

Programmer
Aug 19, 2003
16
CA
I'm new to windows programming.

Can someone help me to understand something about a sample project I have? In it, some function called:
LRESULT CALLBACK wndProc(blah, blah...)

It handles windows messages, such as the application window's WM_CREATE message.
How does the compiler know that this is THE message handler to use? Where does it call it? I've tried using the debugger to find out, but no dice.

 
The OS calls it. It is a callback function that you set in the WNDCLASSEX structure when you register your window class. If you are following a Windows C/C++ beginners tutorial it should certainly be in there. If you are not following a tutorial I highly recommend you get a book targeted at beginner C/C++ Windows development.

-pete
 
You do not call anywhere WndProc. This WndProc is called by Operation System when there happens some events. Windows post in your program's message queue a message what describes the event. In your program, function GetMessage extracts a message from the message queue and DispatchMessage sends message to right WndProc. If in the queue are not messages, function GetMessage will wait until there will be posted some messages.

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Hey, sorry I didn't reply sooner, I moved and didn't have internet access for a while.

Thanks for the clarification IonFlipski!

palbano: Yeah, that's what I'm doing: tutorials(for OpenGL DirectX, and MFC). I was just curious.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top