This is pretty difficult but quite doable. Basically, you need to handle Windows messages
WM_NCCALCSIZE, WM_NCPAINT, WM_NCBUTTONUP, WM_NCBUTTONDOWN, WM_NCMOUSEMOVE, WM_NCRBUTTONDBLCLK
and implement of the logic of button operation. In those
WM_NC...
message names "NC" means non-client.
You also need to consult system metrics to correctly size and position your button, see
http://msdn.microsoft.com/en-us/library/ms724385(v=vs.85).aspx[
^].
—SA