Callback and GetMessage

Just starting out? Need help? Post your questions and find answers here.
Susan20
User
User
Posts: 19
Joined: Fri Feb 29, 2008 1:10 pm
Location: Berlin

Callback and GetMessage

Post by Susan20 »

The SetWindowCallback function is a comfortable way with regard to the treatment of events. But according to the WinApi the API functions GetMessage, TranslateMessage and DispatchMessage should also work. My problem is: These functions require only a pointer to the structure MSG. How do they know what procedure in my PB-code is responsible for the handling of events? Shouldn't there be a pointer to my callback procedure as it is the case when I use: SetWindowCallback(@MyCallbackProcedure)?

P.S.
SetWindowCallback, WaitWindowEvent, WindowEvent - these all work fine. I only want to get a deeper inside in WinAPI. That's why I did post this question.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

When you register your window class the lpfnWndProc member of your WNDCLASSEX structure is where you will store the pointer to your callback.
BERESHEIT
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

My problem is: These functions require only a pointer to the structure MSG.
AFAIK you are not able to obtain this pointer as this would interfere with PB's internal event loop. It's the same problem with the IsDialogMessage_() command wich would enable keyboard navigation like in standard Windows dialogs but you would need the pointer to the MSG structure as well.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Post Reply