GetCursorPos in Borland CPP
-
i know how to get the command GetCursorPos working in vcpp but im having troubles porting to to borland cpp builder 6, it is giving me 2 odd errors. a simple example should do. thank you --------------------- And Like The Wind Our Hero Vanishes Off Into The Distance...
-
i know how to get the command GetCursorPos working in vcpp but im having troubles porting to to borland cpp builder 6, it is giving me 2 odd errors. a simple example should do. thank you --------------------- And Like The Wind Our Hero Vanishes Off Into The Distance...
o nm, it was just a stupid clash of varibles, i was using "Mouse" for my point. So as to help others, i will post what i did POINT MousePos; GetCursorPos(&MousePos); PopupMenu1->Popup(MousePos.x,MousePos.y); Remember that this is for borland cpp builder and not vcpp, although it is basically the same... ty --------------------- And Like The Wind Our Hero Vanishes Off Into The Distance...
-
o nm, it was just a stupid clash of varibles, i was using "Mouse" for my point. So as to help others, i will post what i did POINT MousePos; GetCursorPos(&MousePos); PopupMenu1->Popup(MousePos.x,MousePos.y); Remember that this is for borland cpp builder and not vcpp, although it is basically the same... ty --------------------- And Like The Wind Our Hero Vanishes Off Into The Distance...
Just a stylistic point: if you're creating a popup menu in response to a mouse message, you typically want to create the menu where the pointer was when the mouse was clicked, not where it is now. You get this co-ordinate in the message's
lParam
(see for exampleWM_LBUTTONDOWN
). I'm not familiar with Borland C++ Builder, so I don't know how messages are processed in your application. The exception to this is if you're handling a system tray icon notification message, where you don't get the parameters to the original message (and hence the location of the click). You should use the message's cursor position because the user may have moved the mouse since clicking. If your application, or the system, is busy, this may cause the menu to appear somewhere different, which confuses the user. Stability. What an interesting concept. -- Chris Maunder