devxlogo

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)
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist