DLL Calls to Windows System Functions This technote provides a few hints for developers creating end-user applications. For example, when your user is running the Superbase application, you might not want them to accidentally close it by double clicking on the application control-menu button (the icon in the upper left corner). This technote shows you how to turn off the control-menu button, maximize, and minimize buttons in the Superbase Window. It also shows you how to automatically exit from Windows when you exit your application, and how to turn off the mouse in your application. The procedures use Windows system functions. The code is provided in the \SAMPLES\PROCS\DLL.SPB file which ships with Superbase. Turning off the system, maximize. and minimize controls Ideally, you would call this subroutine from Start.sbp with a call command like: CALL SetWindowAttr(SysMenu%%,Maximize%%,Minimize%%) However, you can also use it elsewhere. SUB SetWindowAttr(SysMenu%%,Maximize%%,Minimize%%) REM Declare all local variables as local DIM hWnd%%,LongWord% REM Register DLL functions REGISTER CLEAR REGISTER "USER.EXE","GetFocus","H" REGISTER "USER.EXE","SetWindowLong","JHIJ" hWnd%% = CALL ("GetFocus") LongWord% = 382664704 REM Turn off the System Control LongWord% = LongWord% - IF (SysMenu%% <> 0,0,524288) REM Turn off the Max control LongWord% = LongWord% - IF (Maximize%% <> 0,0,65536) REM Turn off the Min control LongWord% = LongWord% - IF (Minimize%% <> 0,0,131072) OldWord% = CALL ("SetWindowLong",hWnd%%, - 16,LongWord%) SET POSITION FN sys(9) + 1, FN sys(10) + 1, FN sys(11) - 1, FN sys(12) - 1 SET POSITION FN sys(9) - 1, FN sys(10) - 1, FN sys(11) + 1, FN sys(12) + 1 REGISTER CLEAR END SUB Exiting Windows from your application If you want your users to exit Windows when they exit Superbase, you can call this subroutine from a command button on a form. The call command should look similar to the one shown below: CALL ExitWindows() You could use different procedure name if you choose to. SUB ExitWindows() REM Declare all local variables as local DIM Null%% REM Register DLL functions REGISTER CLEAR REGISTER "USER.EXE","ExitWindows","IHH" Null%% = CALL ("ExitWindows",0,1) REGISTER CLEAR END SUB Turning off the mouse at any time Calling this subroutine hides the mouse pointer until you call it again. This procedure will not work with the SET PAGING OFF command. You need to do a SET PAGING ON before you call this procedure. The call command should look similar to the one shown below: CALL MousePointer(ShowMode%%) SUB MousePointer(ShowMode%%) REM Register DLL functions REGISTER CLEAR REGISTER "USER.EXE","ShowCursor","II" Null%% = CALL ("ShowCursor",ShowMode%%) REGISTER CLEAR END SUB Note : Each of the above procedures does a REGISTER CLEAR before END SUB. If you need to use these procedures more than once, then you should clear the registers at the end as is shown in the above example. Program: Superbase Versions: 2.0 Date: February 7, 1994 D Date: