Remove that Move!

Remove that Move!

Sometimes it is desirable to prevent a user from moving a form.A little known feature of Windows is that for any form, functionalitythat doesn’t appear in the control menu (ControlBox in VB terms)is not available to that form. Therefore, remove the Move commandfrom that form’s control menu to prevent a form from being moved:

 Declare Function GetMenu% Lib "User" (ByVal hWnd%)Declare Function RemoveMenu% Lib "User" (ByVal hMenu%, _        ByVal nPosition%, ByVal wFlags%)Const SC_MOVE = &hF010, MF_BYPOSITION = &H400' This deletes the Move command from the form's' control menuDim Res%Res = RemoveMenu(GetMenu(Form.hWnd), SC_MOVE, MF_BYCOMMAND)


Share the Post: