Disable Window Dragging?

Blitz3D Forums/Blitz3D Beginners Area/Disable Window Dragging?

Guy Fawkes(Posted 2012) [#1]
Hi all, which api_ DECLS function allows me to disable my program from being dragged with the titlebar? Can anyone show an example of how to stop window dragging completely? :) Thanks! :)

Last edited 2012


Kryzon(Posted 2012) [#2]
Get a DECLS for Userlib32 (Code Archives -> User libs -> Search for "Boiled Sweets").

Const SC_MOVE = $F010
Const SC_MAXIMIZE = $F030
Const SC_MINIMIZE = $F020
Const SC_SIZE = $F000

winHWND% = SystemProperty("AppHWND")
winMenu% = api_GetSystemMenu(winHWND, 0)

DeleteMenu(winMenu, SC_MOVE, 0) ;Disable moving.
;DeleteMenu(winMenu, SC_SIZE, 0) ;Disable resizing.
;[...]

UpdateWindow(winHWND)

More SC_ constants here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646360(v=vs.85).aspx


Guy Fawkes(Posted 2012) [#3]
Thanks, @Kryzon! Works like a DREAM! :)


Yasha(Posted 2012) [#4]
I am curious as to how this functionality could possibly be useful.

Normally when you find yourself altering the way users can control your app through Windows, it's a sign you're straying well beyond appropriate territory for a B3D program.

This isn't yet more hilariously misguided "anti-cheat" nonsense, is it?


Guy Fawkes(Posted 2012) [#5]
No. It's more like I'm tired of the process freezing everytime someone goes to drag the window around.... -.-


Unless u know of a way to KEEP a program unfrozen WHILE dragging.


Yasha(Posted 2012) [#6]
The process doesn't freeze. Only the DirectX drawing freezes. The program continues to run uninterrupted. (You will observe how when the mouse is released, the graphical whatnot will "skip" to make up the lost time.)

At least it does on my machine. If it doesn't on yours, it ain't working properly.

Is this really a problem? Are you expecting users to move their window regularly while using your program? Since the process itself should definitely not stop, any net messages will still be received and acted upon, so it should not interrupt sync with anything else.

Unless there's a good reason why this interferes with whatever your app is supposed to do, I would strongly advise against messing with what users expect to be able to do with their own computer. Don't lock the window unless there is a very good reason for its position to be fixed wherever you created it.


Ginger Tea(Posted 2012) [#7]
that yahoo messenger doo dah that opens after the IM itself always opens far across the screen where dragging it to use it is essential (not that I do use it, it gets 'X'ed asap or right clicked bye bye on the task bar.
Perhaps it is expecting there to be a widescreen display and it would be clearly visible, but it ain't and any program that anchors itself to an unuseable area of the screen would find itself in the bin ASAP.


Guy Fawkes(Posted 2012) [#8]
Well, Im creating a window WITHIN a window, so that window must NOT be touched.


Guy Fawkes(Posted 2012) [#9]
Please see my new thread :)