Disable Move SysMenu Item

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Disable Move SysMenu Item

Post by BackupUser »

Code updated for 5.20+

Restored from previous forum. Originally posted by Franco.

Don't know if somebody else has posted such a thing...

Code: Select all

; (c) 2002 - Franco's template - absolutely freeware
; Procedure to make your window unmovable...
; Needs the handle of the window
; Remember: If you make a 'GetSystemMenu_(WindowID,#TRUE)' API call
; after you call this Procedure you get the MoveMenuItem back!
; then you have to remove it again...

Procedure DisableMoveSysMenuItem(WindowID)
  RemoveMenu_(GetSystemMenu_(WindowID, #False),   ;change to #True
              1, #MF_DISABLED | #MF_BYPOSITION)   ;to re-enable Move
  DrawMenuBar_(WindowID)
EndProcedure

OpenWindow(0, #PB_Any, #PB_Any, 200, 100, "Disable Move Item",
           #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
DisableMoveSysMenuItem(WindowID(0))

While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend 
Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.