devxlogo

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)

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Seasoned Architects Evaluate New Tech

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.