augusto 2f90ce3bc6 ./ : aggiunti i pif e gli exe per l'installazione moduli
src/aga		: aggiunti i .rul e la lista per l'installazionecon
		InstallShield3


git-svn-id: svn://10.65.10.50/trunk@6061 c028cbd2-c16b-5b4b-a496-9718f37d4682
1998-01-29 09:22:06 +00:00

918 lines
25 KiB
Plaintext
Executable File

//-----------------------------------------------------------------------------
// InstallSHIELD Sample Files
// Copyright (c) 1990-1994, Stirling Technologies, Inc. All Rights Reserved
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// FILE: WINSUB.RUL
//
// PURPOSE:
// This script interfaces to several Windows APIs.
// For example, WinSubIsWindow (hWnd) interfaces to Windows
// IsWindow API. Please refer to IsWindow API in Windows
// Programmer's Manual for the detailed description.
//
// RESOURCE: NONE
//
// RELATED FILES: WINSUB.H
//
// MAIN FUNCTION CALLS:
// _WinSubGetModuleHandle ( szModule );
// Retrieves the handle of the specified module.
//
// _WinSubShowCursor ( nShow );
// This function shows or hides the cursor.
//
// _WinSubShowWindow ( hWnd, nShow );
// This function sets the given window's visibility state.
//
// _WinSubFocusControl ( hWnd, nBtnId );
// This function sets the input focus to the given child window.
// all subsequent keyboard input is directed to this child window.
// The child window, if any, that previously had the input focus
// loses it.
//
// _WinSubFocusWindow ( hWnd );
// This function sets the input focus to the given window.
// all subsequent keyboard input is directed to this window. The
// window, if any, that previously had the input focus loses it.
//
// _WinSubEnableControl ( hWnd, nBtnID, nEnable );
// This function enables or disables mouse and keyboard input to
// the given window or control. When input is disabled, the window
// ignores input such as mouse clicks and key presses. When input
// is enabled, the window processes all input.
//
// _WinSubGetChildWindow ( hWnd, nBtnID );
// This function retrieves the handle of a control that is in the
// given dialog box.
//
// _WinSubEnableWindow ( INT, INT );
// This function enables or disables mouse and keyboard input to
// the given window or control. When input is disabled, the window
// ignores input such as mouse clicks and key presses. When input
// is enabled, the window processes all input.
//
// _WinSubSetWindowTitle ( hWnd, szText );
// This function sets the given window's title to the specified text.
//
// _WinSubCenterWindow ( hWnd );
// This function changes the position and dimensions to be the center
// of the screen.
//
// _WinSubIsWindow ( hWnd );
// This function determines whether the given window handle is valid.
//
// _WinSubGetWindowRect ( hWnd, nOX, nOY, nSX, nSY );
// This function retrieves the dimensions of the bounding rectangle
// of a given window.
//
// _WinSubGetClientRect ( hWnd, nOX, nOY, nSX, nSY )
// This function retrieves the client coordinates of a window's client
// area.
//
// _WinSubSetWindowPos ( hWnd, nNX, nNY, nSX, nSY, sFlags )
// This function changes the size, position, and Z-order of child,
// pop-up, and top-level windows.
//
// _WinSubMoveWindow ( hWnd, nNX, nNY, nSX, nSY, sFlags )
// This function changes the position and dimensions of a window.
//
// _WinSubPostMessage ( hWnd, nCmd, sParam1, lParam2 )
// This function posts a message in a window's message queue and
// then returns without waiting for the corresponding window to process
// the message.
//
// _WinSubScreenSaver ( TurnOnOff );
// This function checks to see the global variable SCREENSAVER. If it
// is true then sets the state of the screen saver otherwise does nothing.
//
// _WinSubCheckScreenSaver ( )
// This function sets a bool value SCREENSAVER global variable
// that indicates whether a screen saver is on or off.
//
//
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// PARAMETERS
// szModules specifies module name to be tested.
//
// DESCRIPTION
// The routine returns 0 if module is not found, otherwise return -1.
//
// PURPOSE
// Retrieves the handle of the specified module.
//-----------------------------------------------------------------------------
function _WinSubGetModuleHandle ( szModule )
STRING szString [255];
NUMBER hInst;
begin
// Retrieve module handle
hInst = GetModuleHandle (szModule);
if ( hInst = -1 ) then
_WinSubErrDLLFunc ( "GetModuleHandle" );
return -1;
endif;
hInst = hInst & 0x0000FFFF;
if (hInst = 0) then
return 0;
else
return 1;
endif;
end;
//-----------------------------------------------------------------------------
// PARAMETER:
// nShow specifies whether the display count to be increased
// or decreased. The display count is increased if nShow is
// nonzero. Otherwise, it is decreased. The cusor is displayed
// only if the display count is greater than or equal to zero.
// PURPOSE
// This function shows or hides the cursor.
//
//-----------------------------------------------------------------------------
function _WinSubShowCursor ( nShow )
NUMBER nRet;
begin
// Check if the given window handle is valid?
nRet = ShowCursor ( nShow );
if ( nRet = -1 ) then
_WinSubErrDLLFunc ( "ShowCursor" );
nRet = -1;
else
// Need to mark out the higher 2 bytes
nRet = nRet & 0x0000FFFF;
if ( nRet != 0 ) then
nRet = 1;
endif;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// hWnd specifies the window
// nShow specifies how the window is to be shown which
// supports all SWP_* flags under Windows.
// PURPOSE
// This function sets the given window's visibility state.
//
//-----------------------------------------------------------------------------
function _WinSubShowWindow ( hWnd, nShow )
NUMBER nRet;
begin
// Check if the given window handle is valid?
nRet = ShowWindow ( hWnd, nShow );
if ( nRet = -1 ) then
_WinSubErrDLLFunc ( "ShowWindow" );
nRet = -1;
else
// Need to mark out the higher 2 bytes
nRet = nRet & 0x0000FFFF;
if ( nRet != 0 ) then
nRet = 1;
endif;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// hWnd specifies the window or the dialogbox.
// nBtnId specifies the identifier of the control.
// PURPOSE
// This function sets the input focus to the given child window.
// all subsequent keyboard input is directed to this child window.
// The child window, if any, that previously had the input focus
// loses it.
//
//-----------------------------------------------------------------------------
function _WinSubFocusControl ( hWnd, nBtnID )
INT hCtrl;
INT nRet;
begin
// Check window handle
if ( _WinSubIsWindow ( hWnd ) <= 0 ) then
return -1;
endif;
// Retrieve child window handle
hCtrl = _WinSubGetChildWindow ( hWnd, nBtnID );
if ( hCtrl <= 0 ) then
return -1;
endif;
// Enable/disable the window
nRet = _WinSubFocusWindow ( hCtrl );
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETER:
// hWnd specifies the window
// PURPOSE
// This function sets the input focus to the given window.
// all subsequent keyboard input is directed to this window. The
// window, if any, that previously had the input focus loses it.
//
//-----------------------------------------------------------------------------
function _WinSubFocusWindow ( hWnd )
INT nRet;
begin
// Check window handle
if ( _WinSubIsWindow ( hWnd ) <= 0 ) then
return -1;
endif;
// Check if the given window handle is valid?
nRet = SetFocus ( hWnd );
if ( nRet = -1 ) then
_WinSubErrDLLFunc ( "SetFocus" );
nRet = -1;
else
// Need to mark out the higher 2 bytes
nRet = nRet & 0x0000FFFF;
if ( nRet != 0 ) then
nRet = 1;
endif;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// hWnd specifies the window or the dialogbox.
// nBtnID specifies the identifier of the control.
// nEnable specifies to enable or to disable the control.
// PURPOSE
// This function enables or disables mouse and keyboard input to
// the given window or control. When input is disabled, the window
// ignores input such as mouse clicks and key presses. When input
// is enabled, the window processes all input.
//
//-----------------------------------------------------------------------------
function _WinSubEnableControl ( hWnd, nBtnID, nEnable )
INT hCtrl;
INT nRet;
begin
// Check window handle
if ( _WinSubIsWindow ( hWnd ) <= 0 ) then
return -1;
endif;
// Retrieve child window handle
hCtrl = _WinSubGetChildWindow ( hWnd, nBtnID );
if ( hCtrl <= 0 ) then
return -1;
endif;
// Enable/disable the window
nRet = _WinSubEnableWindow ( hCtrl, nEnable );
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// hWnd specifies the window or the dialogbox.
// nBtnID specifies the identifier of the child window.
// PURPOSE
// This function retrieves the handle of a control that is in the
// given dialog box.
//
//-----------------------------------------------------------------------------
function _WinSubGetChildWindow ( hWnd, nBtnID )
INT hCtrl;
begin
// Check window handle
if ( _WinSubIsWindow ( hWnd ) <= 0 ) then
return -1;
endif;
// Check if the given window handle is valid?
hCtrl = GetDlgItem ( hWnd, nBtnID );
if ( hCtrl = -1 ) then
_WinSubErrDLLFunc ( "GetDlgItem" );
hCtrl = -1;
else
// Need to mark out the higher 2 bytes
hCtrl = hCtrl & 0x0000FFFF;
endif;
return hCtrl;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// hWnd specifies the window.
// nBtnID specifies to enable or to disable the window.
// PURPOSE
// This function enables or disables mouse and keyboard input to
// the given window or control. When input is disabled, the window
// ignores input such as mouse clicks and key presses. When input
// is enabled, the window processes all input.
//
//-----------------------------------------------------------------------------
function _WinSubEnableWindow ( hWnd, nEnable )
SHORT sFlag;
INT nRet;
begin
// Check window handle
if ( _WinSubIsWindow ( hWnd ) <= 0 ) then
return -1;
endif;
// Setup flag
if ( nEnable = 0 ) then
sFlag = 0;
else
sFlag = 1;
endif;
// Check if the given window handle is valid?
nRet = EnableWindow ( hWnd, sFlag );
if ( nRet = -1 ) then
_WinSubErrDLLFunc ( "Enable" );
nRet = -1;
else
// Need to mark out the higher 2 bytes
nRet = nRet & 0x0000FFFF;
if ( nRet != 0 ) then
nRet = 1;
endif;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// hWnd specifies the window.
// szText specifies the new caption text.
// PURPOSE
// This function sets the given window's title to the specified text.
//
//-----------------------------------------------------------------------------
function _WinSubSetWindowTitle ( hWnd, szText )
INT nRet;
begin
// Check window handle
if ( _WinSubIsWindow ( hWnd ) <= 0 ) then
return -1;
endif;
// Set window title
nRet = _WinSubSetWindowText ( hWnd, szText );
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETER:
// hWnd is the window or the dialogbox to be centered.
// PURPOSE
// This function changes the position and dimensions to be the center
// of the screen.
//
//-----------------------------------------------------------------------------
function _WinSubCenterWindow ( hWnd )
INT nRet;
INT nOX, nOY, nSX, nSY;
INT nNX, nNY;
SHORT sFlags;
begin
// ## remove this line when hide/show dialogbox are supported
return 0;
// Check window handle
if ( _WinSubIsWindow ( hWnd ) <= 0 ) then
return -1;
endif;
// Retrieve window rect
_WinSubGetWindowRect ( hWnd, nOX, nOY, nSX, nSY );
// Retrieve screen extent
GetExtents ( nNX, nNY );
// Calculate new orig
nSX = nSX - nOX + 1;
nSY = nSY - nOY + 1;
nNX = ( nNX - nSX ) / 2;
nNY = ( nNY - nSY ) / 2;
// Move the window
sFlags = 1;
nRet = _WinSubMoveWindow ( hWnd, nNX, nNY, nSX, nSY, sFlags );
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// hWnd specifies the window.
// szText specifies the new caption text.
// PURPOSE
//
//-----------------------------------------------------------------------------
function _WinSubSetWindowText ( hWnd, szText )
INT nRet;
POINTER pszText;
begin
// Check window handle
if ( _WinSubIsWindow ( hWnd ) <= 0 ) then
return -1;
endif;
// Check if the given window handle is valid?
pszText = AddressString ( szText );
nRet = SetWindowText ( hWnd, pszText );
if ( nRet = -1 ) then
_WinSubErrDLLFunc ( "SetWindowText" );
nRet = -1;
else
nRet = 0 ;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETER:
// hWnd is the window or the dialogbox to be centered.
// PURPOSE
// This function determines whether the given window handle is valid.
//
//-----------------------------------------------------------------------------
function _WinSubIsWindow ( hWnd )
INT nRet;
begin
// Check if the given window handle is valid?
nRet = IsWindow ( hWnd );
if ( nRet = -1 ) then
_WinSubErrDLLFunc ( "IsWindow" );
nRet = -1;
else
// Need to mark out the higher 2 bytes
nRet = nRet & 0x0000FFFF;
if ( nRet != 0 ) then
nRet = 1;
endif;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// (INPUT)
// hWnd specifies the window.
// (OUTPUT)
// nOX receives the X-coord. of the upper-left corner.
// nOY receives the Y-coord. of the upper-left corner.
// nSX receives the X-coord. of the lower-right corner.
// nSY receives the Y-coord. of the lower-right corner.
// PURPOSE
// This function retrieves the dimensions of the bounding rectangle
// of a given window.
//
//-----------------------------------------------------------------------------
function _WinSubGetWindowRect ( hWnd, nOX, nOY, nSX, nSY )
NUMBER nRet;
POINTER pRect;
WINRECTSTRUCT rect;
STRING szTemp [MAX_WINSUB_TMPSTRING_LENGTH];
begin
// Check window handle
if ( _WinSubIsWindow ( hWnd ) <= 0 ) then
return -1;
endif;
// Retrieve the address of the structure
pRect = AddressStruct ( rect );
// Retrieve window rect
nRet = GetWindowRect ( hWnd, pRect );
if ( nRet = -1 ) then
// Can not locate the function?
_WinSubErrDLLFunc ( "GetWindowRect" );
nRet = -1;
else
// Separate each field of the rect structure
StructGet ( rect, "WINRECTSTRUCT", "origX", nOX, szTemp );
StructGet ( rect, "WINRECTSTRUCT", "origY", nOY, szTemp );
StructGet ( rect, "WINRECTSTRUCT", "relX" , nSX, szTemp );
StructGet ( rect, "WINRECTSTRUCT", "relY" , nSY, szTemp );
nRet = 0;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// (INPUT)
// hWnd specifies the window.
// (OUTPUT)
// nOX receives 0.
// nOY receives 0.
// nSX receives the width of the window.
// nSY receives the height of the window.
// PURPOSE
// This function retrieves the client coordinates of a window's client
// area.
//
//-----------------------------------------------------------------------------
function _WinSubGetClientRect ( hWnd, nOX, nOY, nSX, nSY )
NUMBER nRet;
POINTER pRect;
WINRECTSTRUCT rect;
STRING szTemp [MAX_WINSUB_TMPSTRING_LENGTH];
begin
// Check window handle
if ( _WinSubIsWindow ( hWnd ) <= 0 ) then
return -1;
endif;
// Retrieve the address of the structure
pRect = AddressStruct ( rect );
// Retrieve window rect
nRet = GetClientRect ( hWnd, pRect );
if ( nRet = -1 ) then
// Can not locate the function?
_WinSubErrDLLFunc ( "GetClientRect" );
nRet = -1;
else
// Separate each field of the rect structure
StructGet ( rect, "WINRECTSTRUCT", "origX", nOX, szTemp );
StructGet ( rect, "WINRECTSTRUCT", "origY", nOY, szTemp );
StructGet ( rect, "WINRECTSTRUCT", "relX" , nSX, szTemp );
StructGet ( rect, "WINRECTSTRUCT", "relY" , nSY, szTemp );
nRet = 0;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// hWnd specifies the window.
// nNX specifies X-coord. of the new upper-left corner.
// nNY specifies Y-coord. of the new upper-left corner.
// nSX specifies the width of the window.
// nSY specifies the height of the window.
// sFlags supports all SWP_* available in SetWindowPos API.
// PURPOSE
// This function changes the size, position, and Z-order of child,
// pop-up, and top-level windows.
//
//-----------------------------------------------------------------------------
function _WinSubSetWindowPos ( hWnd, nNX, nNY, nSX, nSY, sFlags )
NUMBER nRet;
begin
// Check window handle
if ( _WinSubIsWindow ( hWnd ) <= 0 ) then
return -1;
endif;
// Move window
nRet = SetWindowPos ( hWnd, 0, nNX, nNY, nSX, nSY, sFlags );
if ( nRet = -1 ) then
_WinSubErrDLLFunc ( "SetWindowPos" );
nRet = -1;
else
nRet = 0;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// hWnd specifies the window.
// nNX specifies X-coord. of the new upper-left corner.
// nNY specifies Y-coord. of the new upper-left corner.
// nSX specifies the width of the window.
// nSY specifies the height of the window.
// sFlags specifies whether to redraw the window.
// PURPOSE
// This function changes the position and dimensions of a window.
//
//-----------------------------------------------------------------------------
function _WinSubMoveWindow ( hWnd, nNX, nNY, nSX, nSY, sFlags )
NUMBER nRet;
begin
#ifdef CHECKWINDOW=1
if ( _WinSubIsWindow ( hWnd ) <= 0 ) then
return -1;
endif;
#endif
// Move window
nRet = MoveWindow ( hWnd, nNX, nNY, nSX, nSY, sFlags );
if ( nRet = -1 ) then
_WinSubErrDLLFunc ( "MoveWindow" );
nRet = -1;
else
nRet = 0;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// hWnd specifies the window.
// nCmd specifies the type of message posted.
// sParam1 specifies additional message information.
// lParam2 specifies additional message information.
// PURPOSE
// This function posts a message in a window's message queue and
// then returns without waiting for the corresponding window to process
// the message.
//
//-----------------------------------------------------------------------------
function _WinSubPostMessage ( hWnd, nCmd, sParam1, lParam2 )
NUMBER nRet;
begin
// Move window
nRet = PostMessage ( hWnd, nCmd, sParam1, lParam2 );
if ( nRet = -1 ) then
_WinSubErrDLLFunc ( "PostMessage" );
nRet = -1;
else
nRet = 0;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// TurnOnOff Specifies whether to turn it on or off
// 1 implies TURNON
// 0 implies TURNOFF
// PURPOSE
// This function checks to see the global variable SCREENSAVER. If it
// is true then sets the state of the screen saver otherwise does nothing.
//
//-----------------------------------------------------------------------------
function _WinSubScreenSaver ( TurnOnOff )
NUMBER nRet;
NUMBER nTemp;
begin
nTemp = SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE ;
if ( TurnOnOff = 1 ) then
if ( bSCREENSAVER = 1 ) then
nRet = SystemParametersInfo (
SPI_SETSCREENSAVEACTIVE,
TRUE,
NULL ,
nTemp );
endif;
elseif (TurnOnOff = 0) then
if ( bSCREENSAVER = 1 ) then
nRet = SystemParametersInfo (
SPI_SETSCREENSAVEACTIVE,
FALSE,
NULL ,
nTemp );
endif;
endif;
if ( nRet = -1 ) then
_WinSubErrDLLFunc ( "ShowWindow" );
nRet = -1;
else
// Need to mark out the higher 2 bytes
nRet = nRet & 0x0000FFFF;
if ( nRet != 0 ) then
nRet = 1;
endif;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PURPOSE:
// Check to see if the screen saver is activated if it is then set the
// global variable SCREENSAVER to 1 if it is not then set the global
// variable SCREENSAVER to 0
// PURPOSE
// This function sets a bool value SCREENSAVER global variable
// that indicates whether screen saving is on or off.
//
//-----------------------------------------------------------------------------
function _WinSubCheckScreenSaver ( )
NUMBER nRet;
NUMBER nTemp;
INT nCheckScreenSaver;
POINTER pCheckScreenSaver;
begin
nTemp = SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE ;
pCheckScreenSaver = AddressNumber( nCheckScreenSaver );
nRet = SystemParametersInfo (
SPI_GETSCREENSAVEACTIVE,
0 ,
pCheckScreenSaver ,
nTemp );
// check if the ScreenSaver is on or off
if ( nCheckScreenSaver = TRUE ) then
return 1;
elseif ( nCheckScreenSaver = FALSE ) then
return 0;
endif;
if ( nRet = -1 ) then
_WinSubErrDLLFunc ( "ShowWindow" );
nRet = -1;
else
// Need to mark out the higher 2 bytes
nRet = nRet & 0x0000FFFF;
if ( nRet != 0 ) then
nRet = 1;
endif;
endif;
return nRet;
end;
//-----------------------------------------------------------------------------
// PARAMETERS:
// szDLLFuncName specifies the DLL function name which returns -1.
// PURPOSE
//
//-----------------------------------------------------------------------------
function _WinSubErrDLLFunc ( szDLLFuncName )
STRING szMsg [MAX_WINSUB_MSGSTRING_LENGTH];
begin
szMsg = "InstallSHIELD can not call DLL function: " + szDLLFuncName;
MessageBox ( szMsg, SEVERE );
end;