CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Tue Jul 08, 2003 4:26 pm Post subject: Disable close Button |
|
|
window with its close button as well as Alt+F4 disabled
You may sometimes need that the user closes the window from a button or Menu-->Exit as specified by you. you can do it by sending the app back to the loop at :close label but the user wonders why the window is not closing, If u add a warning/info it can be even more irritating. Your end user reflexly goes to that button. Here is a solution for that in VDS 5.
A window with its close button as well as Alt+F4 disabled.
You may download as a zip file here:
http://www.vdsworld.com/download.php?id=305
Please note that this script uses calling a non vds dll.
Errors done may cuse VDS/system to crash.
Use at your own risk.
Code: | #-----------------------------------------------------------------------------#
#-Calling a Non-VDs dll Disable close button by CodeScript--------------------#
#-Author: CodeScript----------------------------------------------------------#
#-Copyright: You can remove this info while Using this code in your app.------#
#------------but may be kind enough to add a word to documentation------------#
REM USE AT YOUR OWN RISK !!
REM MISTAKES MADE WHILE USING A NON VDS DLL MAY INVITE A VDS/SYSTEM CRASH.
REM SAVE YOUR WORK BEFORE RUNNING/DEBUGGING THIS SCRIPT.
Title Close Disabled Window by CodeScript
DIALOG CREATE, Close Disabled Window by CodeScript,-1,0,356,120,CLASS MYWIN,RESIZABLE
DIALOG ADD,BUTTON,OK,70,112,130,24,Close !
DIALOG ADD,TEXT,TEXT1,36,86,,,Can U close me without this button ?
DIALOG SHOW
LOADLIB USER32
%H = @strdel(@WINEXISTS(#MYWIN),1,1)
IF %H
%I = @lib(user32,GetSystemMenu,INT:,%H, 0)
%J = @lib(user32,GetMenuItemCount,INT:,%I)
%K = @DIFF(%J,1)
%L = @DIFF(%J,2)
%M = @lib(user32,RemoveMenu,BOOL:,%I,%K,$400)
%M = @lib(user32,RemoveMenu,BOOL:,%I,%L,$400)
%M = @lib(user32,DrawMenuBar,BOOL:,%H)
ELSE
ERROR -1
end
FREELIB USER32
:RESIZE
goto evloop
:Evloop
wait event
goto @event()
:OKBUTTON
exit
:Close
REM HERE DON'T PUT EXIT IF U WANT THE USER NOT TO CLOSE THE WINDOW WITH ALT+F4.
REM BUT CAN GIVE A EVENT OF uR CHOICE/BE SILENT BY SENDING BACK TO LOOP AS
REM DONE BELOW.
goto evloop ____________________________________________________________________________________
|
_________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|