InstallShield 2016 » InstallScript Language Reference
Note • To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.
/*--------------------------------------------------------------*\
*
* InstallShield Example Script
*
* Demonstrates the GetSystemInfo function.
*
* This script uses many of the constants available for
* GetSystemInfo and tests for all possible return values.
* The results are displayed in a dialog.
*
\*--------------------------------------------------------------*/
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_GetSystemInfo(HWND);
function ExFn_GetSystemInfo(hMSI)
STRING szTitle, szMsg, svResult, szInfo;
NUMBER nvResult;
LIST listInfo;
begin
// Create a list for system information.
listInfo = ListCreate (STRINGLIST);
// Get the amount of extended memory.
if (GetSystemInfo (EXTENDEDMEMORY, nvResult, svResult) < 0) then
szInfo = "Couldn't get EXTENDEDMEMORY info.";
else
Sprintf(szInfo, "Extended memory: %d K", nvResult);
endif;
// Add the information to the list.
ListAddString(listInfo, szInfo, AFTER);
// Get the boot drive.
if (GetSystemInfo (BOOTUPDRIVE, nvResult, svResult) < 0) then
szInfo = "Couldn't get BOOTUPDRIVE info.";
else
Sprintf(szInfo, "Boot drive: %s", svResult);
endif;
// Add the information to the list.
ListAddString(listInfo, szInfo, AFTER);
// Get info about the CD-ROM.
if (GetSystemInfo (CDROM, nvResult, svResult) < 0) then
szInfo = "Couldn't get CD-ROM info.";
else
if (nvResult = 0) then
svResult = "No";
else
svResult = "Yes";
endif;
Sprintf(szInfo, "CDROM: %s", svResult);
endif;
// Add the information to the list.
ListAddString(listInfo, szInfo, AFTER);
// Get the video adapter.
if (GetSystemInfo (VIDEO, nvResult, svResult) < 0) then
szInfo = "Couldn't get VIDEO info.";
else
switch (nvResult)
case IS_UNKNOWN:
szInfo = "VIDEO: UNKNOWN";
case IS_SVGA:
szInfo = "VIDEO: SVGA";
case IS_XVGA:
szInfo = "VIDEO: XVGA";
case IS_UVGA:
szInfo = "VIDEO: UVGA";
endswitch;
endif;
// Add the information to the list.
ListAddString(listInfo, szInfo, AFTER);
// Get number of available colors.
if (GetSystemInfo (COLORS, nvResult, svResult) < 0) then
szInfo = "Couldn't get COLORS info.";
else
Sprintf(szInfo, "Number of colors: %d", nvResult);
endif;
// Add the information to the list.
ListAddString(listInfo, szInfo, AFTER);
// Get the current date.
if (GetSystemInfo (DATE, nvResult, svResult) < 0) then
szInfo = "Couldn't get DATE info.";
else
Sprintf(szInfo, "DATE: %s", svResult);
endif;
// Add the information to the list.
ListAddString(listInfo, szInfo, AFTER);
// Get the current time.
if (GetSystemInfo (TIME, nvResult, svResult) < 0) then
szInfo = "Couldn't get TIME info.";
else
Sprintf(szInfo, "TIME: %s", svResult);
endif;
// Add the information to the list.
ListAddString(listInfo, szInfo, AFTER);
// Get the operating system.
if (GetSystemInfo (OS, nvResult, svResult) < 0) then
szInfo = "Couldn't get Operating System info.";
else
switch (nvResult)
case IS_WINDOWSNT:
szInfo = "OS: Windows NT";
case IS_WINDOWS9X:
GetSystemInfo (WINMINOR, nvResult, svResult);
if (nvResult < 10) then
szInfo = "OS: Windows 95";
else
szInfo = "OS: Windows 98";
endif;
endswitch;
endif;
// Add the information to the list.
ListAddString(listInfo, szInfo, AFTER);
// Display the information.
szTitle = "System Information";
szMsg = "The following is some information related to your system:\n";
SdShowInfoList (szTitle, szMsg, listInfo);
ListDestroy(listInfo);
end;
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |