|
-
June 22nd, 2001, 05:21 AM
#1
Making the Form immovable
Please help me to make a form immovable without using the movable property.
Thanks
-
June 22nd, 2001, 05:47 AM
#2
Re: Making the Form immovable
Why without using the MoveAble property?
You could intercept the WM_MOVE commands going to the form using a subclassing tool (see http://www.merrioncomputing.com/Download/index.htm for one called EventVB.dll) but this would be no different than that property.
HTH,
D
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
-
June 22nd, 2001, 07:09 AM
#3
Re: Making the Form immovable
I believe ithat if you delete the title bar from the form, then you cannot move the form without applying certian tricks. Try it.
Iouri Boutchkine
[email protected]
-
June 22nd, 2001, 08:47 AM
#4
Re: Making the Form immovable
Another option:
private Declare Function GetSystemMenu Lib "User" (byval hWnd%, byval bRevert%) as Integer
private Declare Function DeleteMenu Lib "user" (byval hMenu%, byval iditem%, byval wflags%) as Integer
private Const SC_SIZE = &HF000
private Const SC_MOVE = &HF010
private Const MF_BYCOMMAND = &H0
Sub Form_Load()
Dim hWnd%, hMenu%, Success%
hWnd% = me.hWnd
hMenu% = GetSystemMenu(hWnd%, 0)
Success% = deletemenu(hMenu%, SC_SIZE, MF_BYCOMMAND)
Success% = deletemenu(hMenu%, SC_MOVE, MF_BYCOMMAND)
End Sub
Deleting the corresponding item from the system menu prevents the action. This code prevents resizing too.
-
June 22nd, 2001, 10:12 AM
#5
Re: Making the Form immovable
Hi shree,
It is an exellent solution. But I believe you have to use "user32" instead of "user"
Iouri Boutchkine
[email protected]
-
June 22nd, 2001, 10:15 AM
#6
Re: Making the Form immovable
Oh yes, this is an example from the MSDN, and I forgot to "upgrade"
-
June 23rd, 2001, 12:36 AM
#7
Re: Making the Form immovable
Excellent but its not working in Windows CE
Iam not finding the getSystemMenu api on windows API
Please help me
-
June 29th, 2001, 12:44 PM
#8
Re: Making the Form immovable
Hello Shree,
How will I know what values are to be passed for the second parameter of DeleteMenu.
You have been giving &HF000 and &HF010. How will we know what value should be specified?
Thanks
Harini
-
June 30th, 2001, 04:18 AM
#9
Re: Making the Form immovable
The common System menu items are Move, Size and Close, SC_CLOSE is defined as &hF060. If you want to access other items, then you can use MF_BYPOSITION and specify the position number, 0 for the first menu item. Here is the code that will remove Restore and Move from the system menu:
Code:
private Declare Function GetSystemMenu Lib "user32" (byval hWnd%, byval bRevert%) as Integer
private Declare Function DeleteMenu Lib "user32" (byval hMenu%, byval iditem%, byval wflags%) as Integer
private Const SC_SIZE = &HF000
private Const SC_MOVE = &HF010
private Const MF_BYCOMMAND = &H0
private Const MF_BYPOSITION = &H400&
Sub Form_Load()
Dim hWnd%, hMenu%, Success%
hWnd% = me.hWnd
hMenu% = GetSystemMenu(hWnd%, 0)
'Success% = DeleteMenu(hMenu%, SC_SIZE, MF_BYCOMMAND)
'Success% = DeleteMenu(hMenu%, SC_MOVE, MF_BYCOMMAND)
Success% = DeleteMenu(hMenu%, 0, MF_BYPOSITION)
Success% = DeleteMenu(hMenu%, 0, MF_BYPOSITION)
End Sub
Note that I use 0 to remove the Move item too, because after Restore is removed, it is the first item in the menu.
Last edited by Cimperiali; April 4th, 2003 at 01:15 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|