moving borderless window / form 
Author Message
 moving borderless window / form

Hi,

I have a small (???) problem: I want to move a window without a
frame/border. I should behave like this:
If you click on an area without an control with the left button you can move
the window to a new position until you release the button. This is the same
method as on the title bar of normal forms/windows.

At the moment I'm moving it by chaning the .Top and .Left properties
according to the mouse position in the MousDown event. Since my window
contains a large graphic this is damn to slow ... i've noticed that Windows
moves such forms much more faster if you use the proper winapi function.

I've ried to send a WM_SYSCOMMAND / SC_MOVE to the form but it only works in
the Click event not under MouseDown or MouseMove. There must be a different
way top do this or I'm missing somwthing.

In short: I'm searching the winapi call that's behind the moveable area of
every window's titlebar.

Thanks in advance for your help,

Claus



Sat, 17 Feb 2001 03:00:00 GMT  
 moving borderless window / form
I like this one...!

Private Const HTCAPTION = 2
private Const WM_NCLBUTTONDOWN = &HA1
private Declare Function DefWindowProc Lib "user32" Alias "DefWindowProcA" _
    (ByVal hwnd As Long, _
    ByVal wMsg As Long, _
    ByVal wParam As Long, _
    ByVal lParam As Long) As Long
private Declare Function ReleaseCapture Lib "user32" () As Long

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single,
y As Single)
    ReleaseCapture
    DefWindowProc Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, ByVal 0&
End Sub

' isnt it beautiful?

WM_NCLBUTTONDOWN means: Non Client Left Button Down

So you are saying the window: hey the user is pressing the mouse in the non
client area, been more specific in the Caption, why dont you move the
window for me?
The ReleaseCapture is just to say the form  leave the mouse alone.

Alejandro Lapeyre

Claus Riethmueller escribi en mensaje ...

Quote:
>Hi,

>I have a small (???) problem: I want to move a window without a
>frame/border. I should behave like this:
>If you click on an area without an control with the left button you can
move
>the window to a new position until you release the button. This is the same
>method as on the title bar of normal forms/windows.

>At the moment I'm moving it by chaning the .Top and .Left properties
>according to the mouse position in the MousDown event. Since my window
>contains a large graphic this is damn to slow ... i've noticed that Windows
>moves such forms much more faster if you use the proper winapi function.

>I've ried to send a WM_SYSCOMMAND / SC_MOVE to the form but it only works
in
>the Click event not under MouseDown or MouseMove. There must be a different
>way top do this or I'm missing somwthing.

>In short: I'm searching the winapi call that's behind the moveable area of
>every window's titlebar.

>Thanks in advance for your help,

>Claus



Sat, 17 Feb 2001 03:00:00 GMT  
 moving borderless window / form
Alejandro,

I hate to spoil a truly elegant solution with a pedantic reply, but I'm just
that sort of guy...

WM_NCLBUTTONDOWN just means NonCLient Button Down, not Left Button.

Forgive me, I just had to point it out!

;^)

    - Paul


    - snip -

Quote:

>WM_NCLBUTTONDOWN means: Non Client Left Button Down

    - snip -


Sat, 17 Feb 2001 03:00:00 GMT  
 moving borderless window / form

Quote:

> Alejandro,

> I hate to spoil a truly elegant solution with a pedantic reply, but I'm just
> that sort of guy...

> WM_NCLBUTTONDOWN just means NonCLient Button Down, not Left Button.

> Forgive me, I just had to point it out!

Then, what do

  WM_NCMBUTTONDOWN and
  WM_NCRBUTTONDOWN

stand for?

--
-- Scott Seligman                  will hack perl for knowledge



Sat, 17 Feb 2001 03:00:00 GMT  
 moving borderless window / form
Then, what do this messages mean?

WM_NCRBUTTONDOWN ?
WM_NCACTIVATE ?

Alejandro Lapeyre


Quote:
>Alejandro,

>I hate to spoil a truly elegant solution with a pedantic reply, but I'm
just
>that sort of guy...

>WM_NCLBUTTONDOWN just means NonCLient Button Down, not Left Button.

>Forgive me, I just had to point it out!

>;^)

>    - Paul



>    - snip -

>>WM_NCLBUTTONDOWN means: Non Client Left Button Down

>    - snip -



Sun, 18 Feb 2001 03:00:00 GMT  
 moving borderless window / form
Good reply Alejandro,
However for the beginners who may be watching, let me point out that the
mouse behavior can be changed from the ControlPanel (for lefties, etc...) so
you should actually THINK "primary mouse button"  rather than "left mouse
button".
I don't think it makes any difference in any case.

Ray Mercer
http://ourworld.compuserve.com/homepages/raymer/vbhome.htm

Quote:

>Then, what do this messages mean?

>WM_NCRBUTTONDOWN ?
>WM_NCACTIVATE ?

>Alejandro Lapeyre


>>Alejandro,

>>I hate to spoil a truly elegant solution with a pedantic reply, but I'm
>just
>>that sort of guy...

>>WM_NCLBUTTONDOWN just means NonCLient Button Down, not Left Button.

>>Forgive me, I just had to point it out!

>>;^)

>>    - Paul



>>    - snip -

>>>WM_NCLBUTTONDOWN means: Non Client Left Button Down

>>    - snip -



Sun, 18 Feb 2001 03:00:00 GMT  
 moving borderless window / form
Doh!  Doh!

I'll just slink off into the corner now...

You got me, Alejandro, I don't know *what* I was thinking when I posted
that...!

    - Paul

Quote:

>Then, what do this messages mean?

>WM_NCRBUTTONDOWN ?
>WM_NCACTIVATE ?

>Alejandro Lapeyre



Mon, 19 Feb 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. moving borderless window / form

2. moving borderless window / form

3. Move a borderless window

4. How to move a borderless form?

5. How can you move a borderless form around in 32-bit VB4 Enterprise

6. Moving a shaped borderless form in real time??

7. HELP with moving borderless forms around screen

8. Borderless Borderless Form

9. Drag borderless form/window?

10. Borderless MDI Parent Window

11. Borderless Window with no Title Bar

12. borderless form automatically resizes?

 

 
Powered by phpBB® Forum Software