How do you get them?
These dont work.Code:while(GetMessage(&Msg, NULL, 0, 0) > 0) { TranslateMessage(&Msg); DispatchMessage(&Msg); } cout << Msg.(&pt) <<"\n"; or cout << Msg->pt <<"\n";
How do you get them?
These dont work.Code:while(GetMessage(&Msg, NULL, 0, 0) > 0) { TranslateMessage(&Msg); DispatchMessage(&Msg); } cout << Msg.(&pt) <<"\n"; or cout << Msg->pt <<"\n";
Using Windows 10 with Code Blocks and MingW.
Usually you process messages in the callback.
Would be easier if you gave more detail of what you want to do (you seem unfamilar with event driven apps). The while loop you posted is a 'message pump'. The only time that while loop ends is when the app closes.
If you just want to get the current mouse position use GetCursorPos().
[note that the point returned is in screen coords]
The trouble is knowing when you need to get the pos....
Last edited by novacain; 12-10-2009 at 07:14 AM.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
Thank you Novocain!
Yeah thats ok im just checking out the messages sent to the window just for fun.
I could check out
and all the rest in the MSG structure except im having trouble with pt.Code:cout << Msg.wParam <<"\n";
So i guess i should know if it has two or four coordinates, its not said on msdn.
MSG Structure ()
Using Windows 10 with Code Blocks and MingW.
Each message has different values sent in the wParam and lParam.
Generally mouse click coord are in the lParam, two ints 'packed' into the DWORD. You have to check what to expect from each msg as some do not send either or both.
Mouse msgs are generally client coords (0,0 is the top left of your dialog, not the screen).
Code://for WM_LBUTTONDOWN etc cout << LOWORD(msg.lParam) <<" \n"; //or GET_X_LPARAM() cout << HIWORD(msg.lParam) <<" \n";
Last edited by novacain; 12-10-2009 at 10:33 PM.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
Thanks to you!
Using Windows 10 with Code Blocks and MingW.