I wanted to make a program that doesn't have a common windows title bar and that can be dragged by clicking anywhere in the form (winamp style).
So I used the following function :
void __fastcall TForm1::WMNCHitTest(TMessage &Msg)
Msg.Result = HTCAPTION;
This funtion traps the WM_NCHITTEST message and by returning HTCAPTION allows the form to be dragged (just like if I clicked in the title bar).
As said in a help file : "The WM_NCHITTEST message is sent to a window when the cursor moves, or when A mouse button is PRESSED or RELEASED ". So the "OnMouse" events don't work anymore. The problem is, I want to detect a right-click in order to show a popup menu and as all the mouse events are trapped by that function, how can I know if a right button was clicked ?