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

Comments

Please log in to comment

Community Chosen Answer

2
You can find all the function parameters and message numbers for the SetWindowLongA API on MSDN. IIRC, though, it's now superceded by SetWindowLongPtr

Also, please use the CODE tag for posting code or other lengthy/wide text. You can access the tag by clicking the button marked '<%'.
Answered 09/24/2009 by: VBScab
Red Belt

Please log in to comment
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
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


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
Answered 09/24/2009 by: Nomi1985
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity