To add to Uraldor's info:
1. Create the control normally.
2. Create your own DIY wndproc for the button control eg BtnProc.
3. Declare a WNDPROC variable to store the original wndproc eg
WNDPROC OldCntrlProc=(WNDPROC)SetWindowLong(hBtn,GWL_WNDPR OC,(LONG)BtnProc);
The return value cast may not be necessary in 'C'. Also there is a new fn, SetWindowLongPtr, that
supercedes SetWindowLong (get ready for 64bit...) that you may also wish to look at.
4. Then in BtnProc:
Code:
LRESULT CALLBACK BtnProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch (uMsg)
{
case WM_LBUTTONDBLCLK: //optional
case WM_LBUTTONDOWN:
{
SendMessage(hwnd,WM_SYSCOMMAND,0xF012,0); /*0xF012=SC_MOVE+HTCAPTION*/
return 0;
}
default: /*pass unhandled msgs to system for default handling*/
return CallWindowProc(OldCntrlProc,hwnd,uMsg,wParam,lParam);
}
}
Same as any other wndproc, except for the default handling fn. When you are done with the control, restore the original wndproc:
SetWindowLong(hBtn,GWL_WNDPROC,(LONG)OldCntrlProc) ;
Hope that's of some use to you.