- Revenera Community
- :
- InstallShield
- :
- InstallShield Knowledge Base
- :
- How to change the default position of Installscript dialogs
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
How to change the default position of Installscript dialogs
How to change the default position of Installscript dialogs
Issue:
By default Installscript dialogs will display in the centre of the screen, this article discussed how to change this location using installscript code.
Solution:
Use the below Installscript code (in bold) in all Dialog init code to change the position of the dialog, where nDx = 200; nDy= 250; are the starting position of the dialog. Same way, you can modify for all other dialog sources used in you installscripts like SdFinish.
// SdWelcome ----------------------------------------------------------------
function SdWelcome(szTitle, szMsg)
string szDlg, szTemp;
number nId, nMessage, nTemp, nSdDialog, nDx, nDy, nWidth, nHeight;
HWND hwndDlg;
BOOL bDone;
RECT rect;
begin
szDlg = SD_DLG_WELCOME;
nSdDialog = SD_NDLG_WELCOME;
// record data produced by this dialog
if(MODE=SILENTMODE) then
SdMakeName( szAppKey, szDlg, szTitle, nSdWelcome );
SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
return nId;
endif;
// ensure general initialization is complete
if(!bSdInit) then
SdInit();
endif;
if(EzDefineDialog( szDlg, "", "", SD_NDLG_WELCOME ) = DLG_ERR) then
return -1;
endif;
Disable( BACKBUTTON );
// Loop in dialog until the user selects a standard button
bDone = FALSE;
while (!bDone)
nId = WaitOnDialog( szDlg );
switch(nId)
case DLG_INIT:
// Put the corresponding Info in the List Field
if( szMsg != "" ) then
SdSetStatic(szDlg, SD_STA_MSG, szMsg);
endif;
hwndDlg = CmdGetHwndDlg( szDlg );
SdGeneralInit( szDlg, hwndDlg, STYLE_NORMAL, szSdProduct );
SdSetDlgTitle(szDlg, hwndDlg, szTitle);
GetWindowRect(hwndDlg, &rect); nWidth = rect.right - rect.left; nHeight = rect.bottom - rect.top; nDx = 200; nDy= 250; MoveWindow(hwndDlg, nDx, nDy, nWidth, nHeight, TRUE);