Jump to content
Tuts 4 You

Move window


wyrda

Recommended Posts

When I paint a window with a picture and set its Style to None I can't move it.I use mouse events to move it but it is using a lot of resources(proc) because my window actually move with the cursor.

How can I move my window just like a normal one?(with that rectangle surrounding it)

Link to comment

When you paint a window, you don't paint the window actually. You're just using a static window control

linked with a picture. And since by default you can't move window controls just by dragging them with

the mouse... forget it. nowai

Link to comment

switch(uMsg)
{
// ... case WM_LBUTTONDOWN:
SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, NULL);
break; // ...
}

^ That's what you mean?

Link to comment

Thanks RaMMicHaeL ! I tried to change WM_LBUTTONDOWN to WM_RBUTTONDOWN but it doesn't work any more.Do you know why?

P.S. I work in c++ builder 2007 and I use message handlers for this.Maybe this is why it doesn't work if I want to move the window with right button.

Link to comment

Are you painting onto a control or onto the window itself? If you are creating a control that is the full size of the window, you will need to subclass the control and handle the WM_LBUTTONDOWN event for the specific control instead of the form in order to move it that way.

Link to comment

wyrda

afaik, this SendMessage call makes Windows think you actually left click on the caption bar.

That's why right click doesn't work - you cannot drag a window using the caption bar with the right mouse button.

Google for the defines WM_NCLBUTTONDOWN, HTCAPTION, it'll probably explain it better.

atom0s

If I got him right, it's just a borderless window with a picture.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...