WiseScript: Any way to disable the ability to move a dialog box?
I can currently remove the close button on a dialog box and also make it so that the dialog box is always on top of any other window. The "Show Desktop" button will not minimize the window either. Is there a way to stop a user from being able to move the window off the screen? Thanks for your help. Below is my code for what I already have. Just copy and paste it into the WiseScript Editor and the editor will show it in its native display format.
item: Remark
Text=Remove "Close" button in upper right corner so the dialog cannot be canceled.
end
item: Call DLL Function
Pathname=%SYS32%\USER32.DLL
Function Name=GetWindowLongA
Argument List=33
Argument List=21-16
Return Variable=2WNDSTYLE
Flags=00100000
end
item: Set Variable
Variable=WNDSTYLE
Value=WNDSTYLE - 524288
Flags=00100000
end
item: Call DLL Function
Pathname=%SYS32%\USER32.DLL
Function Name=SetWindowLongA
Argument List=33
Argument List=21-16
Argument List=20WNDSTYLE
Return Variable=2
Flags=00100000
end
item: Remark
end
item: Remark
Text=Set Window to always be on top; "Show Desktop" will not hide the window.
end
item: Call DLL Function
Pathname=%SYS%\user32.dll
Function Name=SetWindowPos
Argument List=33
Argument List=21-1
Argument List=210
Argument List=210
Argument List=210
Argument List=210
Argument List=2167
Return Variable=0
Flags=00100000
end
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
anonymous_9363
15 years ago
Posted by:
Nomi1985
15 years ago
Cool, thanks for the tip to the Windows API documentation. I was able to figure out how to accomplish what I wanted. It would have been nice to use SetWindowLongPtr for Windows 64-bit support, but I couldn't get that to work. Apparently just changing the call from SetWindowLongA to SetWindowLongPtr does not work. Anyways, here is the code for anyone else that ever wants to do the same thing: If anyone figures out how to get this to work for SetWindowLongPtr, please do post your code.
Also, this site is a great help: http://www.pinvoke.net/index.aspx
Also, this site is a great help: http://www.pinvoke.net/index.aspx
item: Remark
Text=Remove "Close" button in upper right corner so the dialog cannot be canceled.
end
item: Remark
Text=Also, the user will not be able to move the window.
end
item: Call DLL Function
Pathname=%SYS32%\USER32.DLL
Function Name=GetWindowLongA
Argument List=33
Argument List=21-16
Return Variable=2
Flags=00100000
end
item: Call DLL Function
Pathname=%SYS32%\USER32.DLL
Function Name=SetWindowLongA
Argument List=33
Argument List=21-16,8000,10000,20000,0
Return Variable=2
Flags=00100000
end
item: Remark
end
item: Remark
Text=Set Window to always be on top; "Show Desktop" will not hide the window.
end
item: Call DLL Function
Pathname=%SYS%\user32.dll
Function Name=SetWindowPos
Argument List=33
Argument List=21-1
Argument List=210
Argument List=210
Argument List=210
Argument List=210
Argument List=2167
Return Variable=0
Flags=00100000
end
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.