I realize that there are plenty of tutorials on how to create a "Custom Win32 Title Bar." The problem is.. none of the tutorials I have found so far.. discusses how a person would be able to "drag" the replaced title bar.. as one would drag the "normal" title bar.

If you do not know what I mean by "custom" title bar.. it only means that I would like to remove the "initial" window title bar (..the bar upon which the window's title resides) and replace it with one that I drew myself. Not only would I like to replace the standard title bar however.. but I would like to learn how to be able to drag the window from MY custom title bar image.. as one would drag the screen with the standard title bar.

Also.. if it is possible.. I would like to replicate the functionality which the WS_THICKFRAME attribute provides to a window.. only on custom bitmaps.

Example: I want a user to be able to click on lines that I drew.... which would reuslt in the window being scaled.. (as would occur if a person scaled a window with the default window sides provided).

I've found two tutorials on how to drag a window from a custom title bar.. the problem is.. none of the tutorials work.

The first tutorial.. found on Catch22.com's website..
tells me that I need to handle the WM_NCHITEST event.. and have it to return the value of HTCAPTION to signify the caption bar was clicked.

The problem is.. if I attempt to handle any portion of the WM_NCHITEST event.. my screen freezes.. and I am unable to perform ANY actions on the window.. not even clicks.. or mouse movements.

Here is some sample code I used to try to handle the WM_NCHITEST event:

case WM_NCHITTEST:
if (mouseclicked == true)
{return HTCAPTION;}
break;

Also.. on another tutorial found at
http://www.flipcode.com/archives/Win32_Window_Skinning.shtml

I was told that if sent the window message: SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION,NULL);
On a left mouse click.. the window would be fooled into believing that the caption bar was clicked.. and thusly begin to drag as though the caption bar WAS clicked. However.. the above method also.. did not work.

Does any one know why neither of the two window drag methods mentioned above.. worked?
Also.. can someone please offer up another suggestion as to how one would be able to drag a window (with a custom title bar) using Win32?

Alright.. I've managed to get the drag window portion working.. Now I need to simulate the window "scale" functionality on a custom bitmap. Does anyone know the window event that is sent.. when the window is being scaled? Thank you.

Solved. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.