How to retain the values in Customer Information dialog .
In my Application ,its contain the Customer information dialog. it's shows the Text boxes(Username and Password).
Thanks in Advance.
-------------------------------------------------------------------------------------------------------------------------------
0001.#include "ifx.h"
0002.
0003.
0004.#define RES_DIALOG_ID 12001 // ID of the custom dialog box
0005.#define RES_PBUT_NEXT 1 // ID of NextTextBox button
0006.#define RES_PBUT_CANCEL 9 // ID of Cancel button
0007.#define RES_PBUT_BACK 12 // ID of Back button
0008.#define RES_TEXT_WINUSERNAME 301 // ID of IIS Website TextBox
0009.#define RES_TEXT_WINUSERPASS 302 // ID of IIS Port TextBox
0010.//#define RES_TEXT_IISHOST 1321 // ID of IIS Host TextBox
0011.
0012.
0013.prototype NUMBER WindowsUser();
0014.
0015.//export prototype ExFn_SprintfBox(HWND);
0016.//export prototype ExFn_CtrlSetState(HWND);
0017.
0018.function NUMBER WindowsUser()
0019. STRING szDialogName, szMsg,svResult, szDir,szTitle, szPath, szServer, sziLMS;
0020. NUMBER nResult, nCmdValue, hwndDlg, nSize;
0021. BOOL bDone, bFolderExists;
0022. LIST listIISWebSite;
0023. STRING szUNC_AppThemes, szUNC_Debuglog, szUNC_Content,szUNC_iLMS, szUNC_AdhocReports,szUNC_Logon,szUNC_Language, szUNC_FTPClient;
0024.begin
0025. szDialogName = "WindowsUser";
0026.
0027. nResult = EzDefineDialog (szDialogName, "", "", RES_DIALOG_ID);
0028. if (nResult < 0) then
0029. MessageBox ("Error in defining dialog box", SEVERE);
0030. abort;
0031. endif;
0032. bDone = FALSE;
0033. repeat
0034. nCmdValue = WaitOnDialog (szDialogName);
0035. switch (nCmdValue)
0036. case DLG_CLOSE:
0037. Do (EXIT);
0038. case DLG_ERR:
0039. MessageBox ("Unable to display dialog box. Setup canceled.", SEVERE);
0040. abort;
0041. case DLG_INIT:
0042. hwndDlg = CmdGetHwndDlg (szDialogName);
0043.
0044. //nSize = MAX_PATH;
0045. //MsiGetProperty(ISMSI_HANDLE, "ComputerName", szPath, nSize);
0046. //CtrlSetText(szDialogName, RES_TEXT_SERVER, szPath);
0047. CtrlSetText(szDialogName, RES_TEXT_WINUSERNAME, "");
0048.
0049. CtrlSetText(szDialogName, RES_TEXT_WINUSERPASS, "");
0050.
0051. //CtrlSetText(szDialogName, RES_TEXT_IISHOST, "iLMS");
0052.
0053. case RES_PBUT_NEXT:
0054.
0055.
0056. CtrlGetText(szDialogName, RES_TEXT_WINUSERNAME, szDir);
0057. MsiSetProperty ( ISMSI_HANDLE , "WIN_USER" , szDir );
0058.
0059. CtrlGetText(szDialogName, RES_TEXT_WINUSERPASS, szDir);
0060. MsiSetProperty ( ISMSI_HANDLE , "WIN_PASS" , szDir );
0061.
0062. // CtrlGetText(szDialogName, RES_TEXT_IISHOST, szDir);
0063. // MsiSetProperty ( ISMSI_HANDLE , "IIS_HOST" , szDir );
0064.
0065. bDone = TRUE;
0066. /*CtrlSetText(szDialogName, RES_TEXT_WINUSERNAME, "");
0067.
0068. CtrlSetText(szDialogName, RES_TEXT_WINUSERPASS, "");
0069. */
0070. case RES_PBUT_CANCEL:
0071. Do (EXIT);
0072. case RES_PBUT_BACK:
0073. nCmdValue = BACK;
0074.
0075. bDone = TRUE;
0076.
0077. endswitch;
0078. until bDone;
0079.
0080. EndDialog (szDialogName);
0081. ReleaseDialog (szDialogName);
0082. return nCmdValue;
0083. //if (nCmdValue = RES_PBUT_NEXT) then
0084. // MessageBox (szMsg, INFORMATION);
0085. //endif;
0086.end;
0087.
0088.
0089.___________________________________________________________________________________________________________________________________
0090.//===========================================================================
0091.//
0092.// File Name: Setup.rul
0093.//
0094.// Description: Blank setup main script file
0095.//
0096.// Comments: Blank setup is an empty setup project. If you want to
0097.// create a new project via. step-by step instructions use the
0098.// Project Assistant.
0099.//
0100.//===========================================================================
0101.
0102.// Included header files ----------------------------------------------------
0103.// #include "SelectServer.rul"
0104.#include "ifx.h"
0105.#include "WindowsUser.rul"
0106.#include "SQLServerDetail.rul"
0107.
0108.
0109.
0110.//---------------------------------------------------------------------------
0111.// OnBegin
0112.//
0113.// The OnBegin event is called directly by the framework after the setup
0114.// initializes.
0115.//---------------------------------------------------------------------------
0116.function OnBegin()
0117. NUMBER nvType,nSize, iisVersion, nResult;
0118. STRING szReturn, szTitle, szMsg, szKey;
0119. STRING svDir;
0120. BOOL bCreate, bFolderExists;
0121.
0122.begin
0123.//1. //------------------IIS 6.0 Check on Target System --------------------
0124. nSize = -1;
0125. nvType = REGDB_NUMBER;
0126. RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
0127.
0128. if (RegDBGetKeyValueEx("SOFTWARE\\Microsoft\\InetStp","MajorVersion",nvType,szReturn,nSize) < 0) then
0129. MessageBox("The Internet Information Server must be version 6.0" , SEVERE);
0130. abort;
0131. else
0132. if ( StrCompare( szReturn, "6" ) != 0 ) then
0133. MessageBox("The Internet Information Server must be version 6.0", SEVERE);
0134. abort;
0135. endif;
0136. endif;
0137.end;
0138.
0139.//---------------------------------------------------------------------------
0140.// OnFirstUIBefore
0141.//
0142.// The OnFirstUIBefore event is called by the framework when the setup is
0143.// running in first install mode. By default this event displays UI allowing
0144.// the end user to specify installation parameters.
0145.//---------------------------------------------------------------------------
0146.function OnFirstUIBefore()
0147. NUMBER nResult, nSetupType, nvSize, nUser, nSize;
0148. STRING szTitle, szMsg, szQuestion, svName, svCompany, szFile , svDir, szKey;
0149. STRING szLicenseFile, szPath;
0150. BOOL bCustom, bIgnore1, bIgnore2;
0151. BOOL bCreate, bFolderExists;
0152.begin
0153. // TO DO: if you want to enable background, window title, and caption bar title
0154. // SetTitle( @PRODUCT_NAME, 24, WHITE );
0155. // SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );
0156. // Enable( FULLWINDOWMODE );
0157. // Enable( BACKGROUND );
0158. // SetColor(BACKGROUND,RGB (0, 128, 128));
0159.
0160. // Added in InstallShield 15 - Show an appropriate error message if
0161. // -removeonly is specified and the product is not installed.
0162. if( REMOVEONLY ) then
0163. Disable( DIALOGCACHE );
0164. szMsg = SdLoadString( IDS_IFX_ERROR_PRODUCT_NOT_INSTALLED_UNINST );
0165. SdSubstituteProductInfo( szMsg );
0166. MessageBox( szMsg, SEVERE );
0167. abort;
0168. endif;
0169.
0170. nSetupType = TYPICAL;
0171. /*svDir =INSTALLDIR;
0172. szName = "";
0173. szCompany ="";
0174. szSerial ="";
0175. */
0176.Dlg_SdWelcome:
0177. szTitle = "";
0178. szMsg = "";
0179. nResult = SdWelcome(szTitle, szMsg);
0180. if (nResult = BACK) goto Dlg_SdWelcome;
0181.
0182. szTitle = "";
0183. svName = "";
0184. svCompany = "";
0185.
0186.
0187./*
0188.Dlg_SdServerSelect:
0189.
0190. nResult = SdSelectServer( );
0191. if (nResult = BACK) goto Dlg_SdServerSelect;
0192.
0193.
0194.Dlg_SdRegisterUser:
0195. szMsg = "";
0196. szTitle = "";
0197.
0198. nSize = MAX_PATH;
0199. MsiGetProperty(ISMSI_HANDLE, "SELECTED_SERVER", szTitle, nSize);
0200. nResult = SdRegisterUser( szTitle, szMsg, svName, svCompany );
0201. if (nResult = BACK) goto Dlg_SdWelcome;
0202.*/
0203./*
0204.Dlg_SetupType:
0205. szTitle = "";
0206. szMsg = "";
0207. nResult = SetupType2(szTitle, szMsg, "", nSetupType, 0);
0208. if (nResult = BACK) then
0209. goto Dlg_SdRegisterUser;
0210. else
0211. nSetupType = nResult;
0212. if (nSetupType != CUSTOM) then
0213. nvSize = 0;
0214. FeatureCompareSizeRequired(MEDIA, INSTALLDIR, nvSize);
0215. if (nvSize != 0) then
0216. MessageBox(szSdStr_NotEnoughSpace, WARNING);
0217. goto Dlg_SetupType;
0218. endif;
0219. bCustom = FALSE;
0220. goto Dlg_SQL;
0221. else
0222. bCustom = TRUE;
0223. endif;
0224. endif;
0225.*/
0226.
0227.
0228.Dlg_SdSWindowsUser:
0229.
0230. nResult = WindowsUser();
0231. if (nResult = BACK) goto Dlg_SdWelcome;
0232.
0233.Dlg_SdSSQLServerDetail:
0234. RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
0235. szKey = "SOFTWARE\\Microsoft\\Inspired eLearning\\iLMS Database";
0236. if(RegDBKeyExist(szKey) <0) then
0237. nResult = SdSQLServerDetail( );
0238. if (nResult = BACK) goto Dlg_SdSWindowsUser;
0239. endif;
0240.
0241.Dlg_SdAskDestPath:
0242. nResult = SdAskDestPath(szTitle, szMsg, INSTALLDIR, 0);
0243. if (nResult = BACK) goto Dlg_SdSSQLServerDetail;
0244. nSize = MAX_PATH;
0245. MsiGetProperty(ISMSI_HANDLE, "INSTALLDIR", szPath, nSize);
0246. StrRemoveLastSlash ( szPath );
0247. MsiSetProperty ( ISMSI_HANDLE , "INSTALLDIR_UPDATED" , szPath );
0248. //MessageBox(szPath, INFORMATION);
0249.
0250.Dlg_SdStartCopy:
0251. szTitle = "";
0252. szMsg = "";
0253. nResult = SdStartCopy2( szTitle, szMsg );
0254.
0255. if (nResult = BACK) then
0256. goto Dlg_SdAskDestPath;;
0257. endif;
0258.
0259. // Added in IS 2009 - Set appropriate StatusEx static text.
0260. SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) );
0261. // setup default status
0262. Enable(STATUSEX);
0263.
0264. return 0;
0265.end;
0266.
0267.#include "FeatureEvents.rul"
0268.
0269.// AskPath ------------------------------------------------------------------
0270.function AskPath(szMsg, szDefPath, svResultPath)
0271. string szAppKey, svDir, szTitle, szNil;
0272. number nId, nTemp, nLen, nNil;
0273. BOOL bDone;
0274. HWND hDlg, hEdit;
0275.begin
0276.
0277. // record data produced by this dialog
0278. if(MODE = SILENTMODE) then
0279. SdMakeName(szAppKey, DLG_ASKPATH, "", g_nDlgAskPath);
0280. SilentReadData(szAppKey, "Result", DATA_NUMBER, szNil, nId);
0281. if((nId != BACK) && (nId != CANCEL)) then
0282. SilentReadData(szAppKey, "szPath", DATA_STRING, svResultPath, nNil);
0283. endif;
0284. return nId;
0285. endif;
0286.
0287. // ensure general initialization is complete
0288. if(!bSdInit) then
0289. SdInit();
0290. endif;
0291.
0292. if(EzDefineDialog(DLG_ASKPATH, "", "", DLG_ASKPATH_ID) = DLG_ERR) then
0293. return ISERR_GEN_FAILURE;
0294. endif;
0295.
0296. // Loop in dialog until the user selects a standard button
0297. bDone = FALSE;
0298.
0299. while (!bDone)
0300.
0301. nId = WaitOnDialog(DLG_ASKPATH);
0302.
0303. switch (nId)
0304.
0305. case DLG_INIT:
0306.
0307. CtrlSetText(DLG_ASKPATH, EDIT_TEXT, szDefPath);
0308.
0309. nLen = StrLengthChars(svResultPath);
0310. if(nLen = 0) then
0311. Resize(svDir, 256);
0312. nLen = Resize(svResultPath, 256);
0313. endif;
0314. svDir = szDefPath;
0315.
0316. if(szMsg != "") then
0317. CtrlSetText(DLG_ASKPATH, STATIC_TEXT, szMsg);
0318. endif;
0319.
0320. hDlg = CmdGetHwndDlg(DLG_ASKPATH);
0321. SdGeneralInit(DLG_ASKPATH, hDlg, 0, szSdProduct);
0322.
0323. hEdit = CtrlGetDlgItem("", hDlg, EDIT_TEXT);
0324. if(nLen < 255) then
0325. nLen = 255;
0326. endif;
0327. SendMessage(hEdit, EM_LIMITTEXT, nLen-2, 0);
0328.
0329. szTitle = GetDialogTitle(DLG_ASK_PATH);
0330. SdSetDlgTitle(DLG_ASKPATH, hDlg, szTitle);
0331.
0332. case SD_PBUT_BROWSE:
0333.
0334. CtrlGetText(DLG_ASKPATH, EDIT_TEXT, svDir);
0335. StrTrim(svDir);
0336. SelectDir("", "", svDir, FALSE);
0337. CtrlSetText(DLG_ASKPATH, EDIT_TEXT, svDir);
0338.
0339. case SD_PBUT_CONTINUE:
0340.
0341. CtrlGetText(DLG_ASKPATH, EDIT_TEXT, svDir);
0342. StrTrim(svDir);
0343. ParsePath(szNil, svDir, PATH);
0344. if(szNil != svDir) then
0345. PthFixPath(svDir, PthIsAbsPath(svDir));
0346. endif;
0347.
0348. svResultPath = svDir;
0349. nId = NEXT;
0350. bDone = TRUE;
0351.
0352. case SD_PBUT_BACK:
0353.
0354. nId = BACK;
0355. bDone = TRUE;
0356.
0357. case DLG_ERR:
0358.
0359. nId = ISERR_GEN_FAILURE;
0360. SdError(nId, DLG_ASKPATH);
0361. bDone = TRUE;
0362.
0363. case DLG_CLOSE:
0364.
0365. SdCloseDlg(hDlg, nId, bDone);
0366.
0367. default:
0368.
0369. // check standard handling
0370. if(SdIsStdButton(nId) && SdDoStdButton(nId)) then
0371. if(nId != EDIT_TEXT) then
0372. bDone = TRUE;
0373. endif;
0374. endif;
0375. svResultPath = svDir;
0376.
0377. endswitch;
0378.
0379. endwhile;
0380.
0381. // Cleanup Dialog
0382. EndDialog(DLG_ASKPATH);
0383. ReleaseDialog(DLG_ASKPATH);
0384. SdUnInit();
0385.
0386. // record data produced by this dialog
0387. if(MODE = RECORDMODE) then
0388. SdMakeName(szAppKey, DLG_ASKPATH, "", g_nDlgAskPath);
0389. SilentWriteData(szAppKey, "szPath", DATA_STRING, svResultPath, nNil);
0390. SilentWriteData(szAppKey, "Result", DATA_NUMBER, szNil, nId);
0391. endif;
0392.
0393. return nId;
0394.
0395.end;
0396.
0397.// EnterDisk ----------------------------------------------------------------
0398.function EnterDisk(szMsg, szTagFile)
0399. string szPath, svResult, szTitle;
0400. BOOL bDone;
0401. HWND hDlg, hEdit;
0402. number nId, nLen;begin
0403.
0404. // ensure general initialization is complete
0405. if(!bSdInit) then
0406. SdInit();
0407. endif;
0408.
0409. if(EzDefineDialog(DLG_ENTERDISK, "", "", DLG_ENTERDISK_ID) = DLG_ERR) then
0410. return -1;
0411. endif;
0412.
0413. // Loop in dialog until the user selects a standard button
0414. bDone = FALSE;
0415.
0416. MessageBeep(0);
0417.
0418. while (!bDone)
0419.
0420. nId = WaitOnDialog(DLG_ENTERDISK);
0421.
0422. switch(nId)
0423.
0424. case DLG_INIT:
0425.
0426. hDlg = CmdGetHwndDlg(DLG_ENTERDISK);
0427. if(szSdProduct = "") then
0428. szSdProduct = " ";
0429. endif;
0430. SdGeneralInit(DLG_ENTERDISK, hDlg, 0, szSdProduct);
0431.
0432. if(szMsg != "") then
0433. CtrlSetText(DLG_ENTERDISK, STATIC_TEXT, szMsg);
0434. endif;
0435.
0436. hEdit = CtrlGetDlgItem("", hDlg, EDIT_TEXT);
0437. if(nLen < 255) then
0438. nLen = 255;
0439. endif;
0440. SendMessage(hEdit, EM_LIMITTEXT, nLen-2, 0);
0441.
0442. CtrlSetText(DLG_ENTERDISK, EDIT_TEXT, SRCDIR);
0443.
0444. szTitle = GetDialogTitle(DLG_ENTER_DISK);
0445. if(szTitle != "") then
0446. SetWindowText(hDlg, szTitle);
0447. endif;
0448.
0449. case SD_PBUT_BROWSE:
0450.
0451. CtrlGetText(DLG_ENTERDISK, EDIT_TEXT, szPath);
0452. SelectDir("", SdLoadString( DLG_STR_TXT_ENTERDISKBROWSE ), szPath, FALSE);
0453. CtrlSetText(DLG_ENTERDISK, EDIT_TEXT, szPath);
0454.
0455. case SD_PBUT_CONTINUE:
0456.
0457. CtrlGetText(DLG_ENTERDISK, EDIT_TEXT, szPath);
0458.
0459. if(EnterDiskError(szPath, szTagFile) = ISERR_SUCCESS) then
0460. nId = NEXT;
0461. bDone = TRUE;
0462. SRCDIR = szPath;
0463. endif;
0464.
0465. case DLG_ERR:
0466.
0467. nId = ISERR_GEN_FAILURE;
0468. SdError(nId, DLG_ENTERDISK);
0469. bDone = TRUE;
0470.
0471. case DLG_CLOSE:
0472.
0473. SdCloseDlg(hDlg, nId, bDone);
0474.
0475. default:
0476.
0477. // check standard handling
0478. if(SdIsStdButton(nId) && SdDoStdButton(nId)) then
0479. if(nId != EDIT_TEXT) then
0480. bDone = TRUE;
0481. endif;
0482. endif;
0483.
0484. endswitch;
0485.
0486. endwhile;
0487.
0488. // Cleanup Dialog
0489. EndDialog(DLG_ENTERDISK);
0490. ReleaseDialog(DLG_ENTERDISK);
0491. SdUnInit();
0492.
0493. return nId;
0494.
0495.end;
0496.
0497.// EnterPassword ------------------------------------------------------------
0498.function EnterPassword(szMsg, szDefault, svResult)
0499. number nId, nLen, nStyle, nNil;
0500. string szAppKey, szNil, szCaption, szTitle;
0501. BOOL bDone;
0502. HWND hDlg, hEdit;
0503.begin
0504.
0505. // record data produced by this dialog
0506. if(MODE = SILENTMODE) then
0507. SdMakeName(szAppKey, DLG_ENTERPASSWORD, "", nDlgEnterPassword);
0508. SilentReadData(szAppKey, "Result", DATA_NUMBER, szNil, nId);
0509. if((nId != BACK) && (nId != CANCEL)) then
0510. SilentReadData(szAppKey, "szMsg", DATA_STRING, svResult, nNil);
0511. endif;
0512. return nId;
0513. endif;
0514.
0515. // ensure general initialization is complete
0516. if(!bSdInit) then
0517. SdInit();
0518. endif;
0519.
0520. if(EzDefineDialog(DLG_ENTERPASSWORD, "", "", DLG_ENTERPASSWORD_ID) = DLG_ERR) then
0521. return ISERR_GEN_FAILURE;
0522. endif;
0523.
0524. // Loop in dialog until the user selects a standard button
0525. bDone = FALSE;
0526.
0527. while (!bDone)
0528. nId = WaitOnDialog(DLG_ENTERPASSWORD);
0529.
0530. switch (nId)
0531.
0532. case DLG_INIT:
0533.
0534. CtrlSetText(DLG_ENTERPASSWORD, EDIT_TEXT, szDefault);
0535.
0536. nLen = StrLengthChars(svResult);
0537. if(nLen = 0) then
0538. nLen = Resize(svResult, 256);
0539. endif;
0540. svResult = szDefault;
0541.
0542. if(szMsg != "") then
0543. CtrlSetText(DLG_ENTERPASSWORD, STATIC_TEXT, szMsg);
0544. endif;
0545.
0546. hDlg = CmdGetHwndDlg(DLG_ENTERPASSWORD);
0547. SdGeneralInit(DLG_ENTERPASSWORD, hDlg, 0, szSdProduct);
0548.
0549. szTitle = GetDialogTitle(DLG_ASK_TEXT);
0550. SdSetDlgTitle(DLG_ENTERPASSWORD, hDlg, szTitle);
0551.
0552. hEdit = CtrlGetDlgItem("", hDlg, EDIT_TEXT);
0553. if(nLen < 255) then
0554. nLen = 255;
0555. endif;
0556. SendMessage(hEdit, EM_LIMITTEXT, nLen-1, 0);
0557.
0558. nStyle = GetWindowLong(hEdit, GWL_STYLE);
0559. nStyle = (nStyle & ~ES_OEMCONVERT);
0560. SetWindowLong(hEdit, GWL_STYLE, nStyle);
0561.
0562. case SD_PBUT_CONTINUE:
0563.
0564. CtrlGetText(DLG_ENTERPASSWORD, EDIT_TEXT, svResult);
0565. nId = NEXT;
0566. bDone = TRUE;
0567.
0568. case SD_PBUT_BACK:
0569.
0570. nId = BACK;
0571. bDone = TRUE;
0572.
0573. case DLG_ERR:
0574.
0575. nId = ISERR_GEN_FAILURE;
0576. SdError(nId, DLG_ENTERPASSWORD);
0577. bDone = TRUE;
0578.
0579. case DLG_CLOSE:
0580.
0581. SdCloseDlg(hDlg, nId, bDone);
0582.
0583. default:
0584.
0585. // check standard handling
0586. if(SdIsStdButton(nId) && SdDoStdButton(nId)) then
0587. if(nId != EDIT_TEXT) then
0588. bDone = TRUE;
0589. endif;
0590. endif;
0591. CtrlGetText(DLG_ENTERPASSWORD, EDIT_TEXT, svResult);
0592.
0593. endswitch;
0594.
0595. endwhile;
0596.
0597. // Cleanup Dialog
0598. EndDialog(DLG_ENTERPASSWORD);
0599. ReleaseDialog(DLG_ENTERPASSWORD);
0600. SdUnInit();
0601.
0602. // record data produced by this dialog
0603. if(MODE = RECORDMODE) then
0604. SdMakeName(szAppKey, DLG_ENTERPASSWORD, "", nDlgEnterPassword);
0605. SilentWriteData(szAppKey, "szMsg", DATA_STRING, svResult, nNil);
0606. SilentWriteData(szAppKey, "Result", DATA_NUMBER, szNil, nId);
0607. endif;
0608.
0609. return nId;
0610.
0611.end;
0612.
0613.// EnterLoginInfo -----------------------------------------------------------
0614.function EnterLoginInfo(szMsg, svUser, svPassword)
0615. number nId, nLen, nStyle, nNil;
0616. string szAppKey, szNil, szCaption, szTitle;
0617. BOOL bDone;
0618. HWND hDlg, hEditName, hEditPassword;
0619.begin
0620.
0621. // record data produced by this dialog
0622. if(MODE = SILENTMODE) then
0623. SdMakeName(szAppKey, DLG_ENTERLOGIN, "", nDlgEnterLogin);
0624. SilentReadData(szAppKey, "Result", DATA_NUMBER, szNil, nId);
0625. if((nId != BACK) && (nId != CANCEL)) then
0626. SilentReadData( szAppKey, "szUser", DATA_STRING, svUser, nNil );
0627. SilentReadData( szAppKey, "szPass", DATA_STRING, svPassword, nNil );
0628. endif;
0629. return nId;
0630. endif;
0631.
0632. // ensure general initialization is complete
0633. if(!bSdInit) then
0634. SdInit();
0635. endif;
0636.
0637. if(EzDefineDialog(DLG_ENTERLOGIN, "", "", DLG_ENTERLOGIN_ID) = DLG_ERR) then
0638. return ISERR_GEN_FAILURE;
0639. endif;
0640.
0641. // Loop in dialog until the user selects a standard button
0642. bDone = FALSE;
0643.
0644. while (!bDone)
0645.
0646. nId = WaitOnDialog(DLG_ENTERLOGIN);
0647.
0648. switch (nId)
0649.
0650. case DLG_INIT:
0651.
0652. // Set Defaults
0653. CtrlSetText(DLG_ENTERLOGIN, SD_EDIT_NAME, svUser);
0654. CtrlSetText(DLG_ENTERLOGIN, SD_EDIT_PASSWORD, svPassword);
0655.
0656. nLen = StrLengthChars(svUser);
0657. if(nLen = 0) then
0658. nLen = Resize(svUser, 256);
0659. endif;
0660.
0661. nLen = StrLengthChars(svPassword);
0662. if(nLen = 0) then
0663. nLen = Resize(svPassword, 256);
0664. endif;
0665.
0666. if(szMsg != "") then
0667. CtrlSetText(DLG_ENTERLOGIN, STATIC_TEXT, szMsg);
0668. endif;
0669.
0670. hDlg = CmdGetHwndDlg(DLG_ENTERLOGIN);
0671. SdGeneralInit(DLG_ENTERLOGIN, hDlg, 0, szSdProduct);
0672.
0673. szTitle = GetDialogTitle(DLG_ASK_TEXT);
0674. SdSetDlgTitle(DLG_ENTERLOGIN, hDlg, szTitle);
0675.
0676. hEditName = CtrlGetDlgItem("", hDlg, SD_EDIT_NAME);
0677. if(nLen < 255) then
0678. nLen = 255;
0679. endif;
0680. SendMessage(hEditName, EM_LIMITTEXT, nLen-1, 0);
0681.
0682. hEditPassword = CtrlGetDlgItem("", hDlg, SD_EDIT_PASSWORD);
0683. if(nLen < 255) then
0684. nLen = 255;
0685. endif;
0686. SendMessage(hEditPassword, EM_LIMITTEXT, nLen-1, 0);
0687.
0688. nStyle = GetWindowLong(hEditPassword, GWL_STYLE);
0689. nStyle = (nStyle & ~ES_OEMCONVERT);
0690. SetWindowLong(hEditPassword, GWL_STYLE, nStyle);
0691.
0692. case SD_PBUT_CONTINUE:
0693.
0694. CtrlGetText(DLG_ENTERLOGIN, SD_EDIT_NAME, svUser);
0695. CtrlGetText(DLG_ENTERLOGIN, SD_EDIT_PASSWORD, svPassword);
0696. nId = NEXT;
0697. bDone = TRUE;
0698.
0699. case SD_PBUT_BACK:
0700.
0701. nId = BACK;
0702. bDone = TRUE;
0703.
0704. case DLG_ERR:
0705.
0706. nId = ISERR_GEN_FAILURE;
0707. SdError(nId, DLG_ENTERLOGIN);
0708. bDone = TRUE;
0709.
0710. case DLG_CLOSE:
0711.
0712. SdCloseDlg(hDlg, nId, bDone);
0713.
0714. default:
0715.
0716. // check standard handling
0717. if(SdIsStdButton(nId) && SdDoStdButton(nId)) then
0718. if((nId != SD_EDIT_NAME) && (nId != SD_EDIT_PASSWORD)) then
0719. bDone = TRUE;
0720. endif;
0721. endif;
0722.
0723. CtrlGetText(DLG_ENTERLOGIN, SD_EDIT_NAME, svUser);
0724. CtrlGetText(DLG_ENTERLOGIN, SD_EDIT_PASSWORD, svPassword);
0725.
0726. endswitch;
0727.
0728. endwhile;
0729.
0730. EndDialog(DLG_ENTERLOGIN);
0731. ReleaseDialog(DLG_ENTERLOGIN);
0732. SdUnInit();
0733.
0734. // record data produced by this dialog
0735. if(MODE = RECORDMODE) then
0736. SdMakeName(szAppKey, DLG_ENTERLOGIN, "", nDlgEnterLogin);
0737. SilentWriteData( szAppKey, "szUser", DATA_STRING, svUser, nNil );
0738. SilentWriteData( szAppKey, "szPass", DATA_STRING, svPassword, nNil );
0739. SilentWriteData(szAppKey, "Result", DATA_NUMBER, szNil, nId);
0740. endif;
0741.
0742. return nId;
0743.
0744.end;
0745.
0746.// SdRegisterUser -----------------------------------------------------------
0747.function SdRegisterUser( szTitle, szMsg, svName, svCompany )
0748. string szDlg, szTemp;
0749. number nId, nMessage, nTemp, nSdDialog;
0750. HWND hwndDlg, hwndNext;
0751. BOOL bDone;
0752.begin
0753.
0754. szDlg = SD_DLG_REGISTERUSER;
0755. nSdDialog = SD_NDLG_REGISTERUSER;
0756.
0757. // record data produced by this dialog
0758. if(MODE=SILENTMODE) then
0759. SdMakeName( szAppKey, szDlg, szTitle, nSdRegisterUser );
0760. SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
0761. SilentReadData( szAppKey, "szName", DATA_STRING, svName, nTemp );
0762. SilentReadData( szAppKey, "szCompany", DATA_STRING, svCompany, nTemp );
0763. IFX_PRODUCT_REGISTEREDOWNER = svName;
0764. IFX_PRODUCT_REGISTEREDCOMPANY = svCompany;
0765. return nId;
0766. endif;
0767.
0768. // ensure general initialization is complete
0769. if(!bSdInit) then
0770. SdInit();
0771. endif;
0772.
0773. if( EzDefineDialog( szDlg, "", "", SD_NDLG_REGISTERUSER ) = DLG_ERR) then
0774. return -1;
0775. endif;
0776.
0777. // Loop in dialog until the user selects a standard button
0778. bDone = FALSE;
0779.
0780. while (!bDone)
0781.
0782. nId = WaitOnDialog( szDlg );
0783.
0784. switch(nId)
0785.
0786. case DLG_INIT:
0787.
0788.
0789. if( szMsg != "" ) then
0790. SdSetStatic( szDlg, SD_STA_MSG, szMsg );
0791. endif;
0792.
0793. if( !StrLengthChars( svName ) ) then
0794. svName = IFX_PRODUCT_REGISTEREDOWNER;
0795. endif;
0796.
0797. if( !StrLengthChars( svCompany ) ) then
0798. svCompany = IFX_PRODUCT_REGISTEREDCOMPANY;
0799. endif;
0800.
0801. CtrlSetText( szDlg, SD_EDIT_NAME, svName );
0802. CtrlSetText( szDlg, SD_EDIT_COMPANY, svCompany );
0803.
0804. hwndDlg = CmdGetHwndDlg( szDlg );
0805. hwndNext = CtrlGetDlgItem("", hwndDlg, NEXT );
0806. SdGeneralInit( szDlg, hwndDlg, STYLE_BOLD, szSdProduct );
0807.
0808. SdSetDlgTitle(szDlg, hwndDlg, szTitle);
0809.
0810. case SD_EDIT_NAME:
0811.
0812. // Enable/Disable next button
0813. nMessage = CtrlGetSubCommand(szDlg);
0814. if(nMessage = EDITBOX_CHANGE) then
0815. CtrlGetText(szDlg, SD_EDIT_NAME, svName);
0816. StrTrim( svCompany );
0817. StrTrim( svName );
0818. EnableWindow( hwndNext, StrLengthChars( svName ) && StrLengthChars( svCompany ) );
0819. endif;
0820.
0821. case SD_EDIT_COMPANY:
0822.
0823. // Enable/Disable next button
0824. nMessage = CtrlGetSubCommand(szDlg);
0825. if(nMessage = EDITBOX_CHANGE) then
0826. CtrlGetText(szDlg, SD_EDIT_COMPANY, svCompany);
0827. StrTrim( svCompany );
0828. StrTrim( svName );
0829. EnableWindow( hwndNext, StrLengthChars( svName ) && StrLengthChars( svCompany ) );
0830. endif;
0831.
0832. case NEXT:
0833.
0834. nId = NEXT;
0835. bDone = TRUE;
0836.
0837. case BACK:
0838.
0839. nId = BACK;
0840. bDone = TRUE;
0841.
0842. case BACK:
0843.
0844. nId = BACK;
0845. bDone = TRUE;
0846.
0847. case DLG_ERR:
0848.
0849. SdError( -1, "SdRegisterUser" );
0850. nId = -1;
0851. bDone = TRUE;
0852.
0853. case DLG_CLOSE:
0854.
0855. SdCloseDlg( hwndDlg, nId, bDone );
0856.
0857. default:
0858.
0859. // check standard handling
0860. if(SdIsStdButton( nId ) && SdDoStdButton( nId )) then
0861. bDone = TRUE;
0862. endif;
0863.
0864. endswitch;
0865.
0866. endwhile;
0867.
0868. IFX_PRODUCT_REGISTEREDOWNER = svName;
0869. IFX_PRODUCT_REGISTEREDCOMPANY = svCompany;
0870.
0871. // Cleanup Dialog
0872. EndDialog( szDlg );
0873. ReleaseDialog( szDlg );
0874. SdUnInit();
0875.
0876. // record data produced by this dialog
0877. if(MODE=RECORDMODE) then
0878. SdMakeName( szAppKey, szDlg, szTitle, nSdRegisterUser );
0879. SilentWriteData( szAppKey, "szName", DATA_STRING, svName, 0 );
0880. SilentWriteData( szAppKey, "szCompany", DATA_STRING, svCompany, 0 );
0881. SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
0882. endif;
0883.
0884. return nId;
0885.
0886.end;
0887.
0888.// SdSelectFolder -----------------------------------------------------------
0889.function SdSelectFolder( szTitle, szMsg, svDefGroup )
0890. string szDlg, szTemp, szGroup, szStr_InvalidFolder, szStr_InvalidFdr_Title;
0891. number nId, nMessage, nTemp, nOS, hIsres, nSdDialog;
0892. HWND hwndDlg, hwndEdit;
0893. BOOL bDone;
0894.begin
0895.
0896. Enable(HOURGLASS);
0897. szDlg = SD_DLG_SELECTFOLDER;
0898. nSdDialog = SD_NDLG_SELECTFOLDER;
0899.
0900. // record data produced by this dialog
0901. if(MODE=SILENTMODE) then
0902. SdMakeName( szAppKey, szDlg, szTitle, nSdSelectFolder );
0903. SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
0904. if((nId != BACK) && (nId != CANCEL)) then
0905. SilentReadData( szAppKey, "szFolder", DATA_STRING, svDefGroup, nTemp );
0906. endif;
0907. Disable(HOURGLASS);
0908. return nId;
0909. endif;
0910.
0911. // ensure general initialization is complete
0912. if(!bSdInit) then
0913. SdInit();
0914. endif;
0915.
0916. if(EzDefineDialog( szDlg, "", "", SD_NDLG_SELECTFOLDER ) = DLG_ERR) then
0917. Disable(HOURGLASS);
0918. return -1;
0919. endif;
0920.
0921. // Loop in dialog until the user selects a standard button
0922. bDone = FALSE;
0923.
0924. while (!bDone)
0925.
0926. nId = WaitOnDialog( szDlg );
0927. switch(nId)
0928.
0929. case DLG_INIT:
0930.
0931. if( szMsg != "" ) then
0932. SdSetStatic(szDlg, SD_STA_MSG, szMsg);
0933. endif;
0934.
0935. szGroup = svDefGroup;
0936.
0937. CtrlSetText( szDlg, SD_EDIT_PROGGRP, szGroup );
0938. CtrlPGroups( szDlg, SD_LIST_EXISTGRP );
0939. CtrlSetCurSel( szDlg, SD_LIST_EXISTGRP, szGroup );
0940.
0941. hwndDlg = CmdGetHwndDlg( szDlg );
0942. SdGeneralInit( szDlg, hwndDlg, STYLE_BOLD, szSdProduct );
0943.
0944. SdSetDlgTitle(szDlg, hwndDlg, szTitle);
0945.
0946. Disable(HOURGLASS);
0947.
0948. case SD_LIST_EXISTGRP:
0949.
0950. CtrlGetCurSel(szDlg, SD_LIST_EXISTGRP, szGroup );
0951. CtrlSetText(szDlg, SD_EDIT_PROGGRP, szGroup );
0952.
0953. case NEXT:
0954.
0955. CtrlGetText(szDlg, SD_EDIT_PROGGRP, szGroup );
0956.
0957. if(SdVerifyFolder(szGroup) = ISERR_SUCCESS) then
0958. svDefGroup = szGroup;
0959. nId = NEXT;
0960. bDone = TRUE;
0961. else
0962. MessageBeep(0);
0963. hwndEdit = CtrlGetDlgItem("", hwndDlg, SD_EDIT_PROGGRP);
0964. SetFocus(hwndEdit);
0965. endif;
0966.
0967. case BACK:
0968.
0969. nId = BACK;
0970. bDone = TRUE;
0971.
0972. case DLG_ERR:
0973.
0974. SdError( -1, "SdSelectFolder" );
0975. nId = -1;
0976. bDone = TRUE;
0977.
0978. case DLG_CLOSE:
0979.
0980. SdCloseDlg( hwndDlg, nId, bDone );
0981.
0982. default:
0983.
0984. // check standard handling
0985. if(SdIsStdButton( nId ) && SdDoStdButton( nId )) then
0986. bDone = TRUE;
0987. endif;
0988.
0989. endswitch;
0990.
0991. endwhile;
0992.
0993. // Cleanup Dialog
0994. EndDialog( szDlg );
0995. ReleaseDialog( szDlg );
0996. SdUnInit();
0997. Disable(HOURGLASS);
0998.
0999. // record data produced by this dialog
1000. if(MODE=RECORDMODE) then
1001. SdMakeName( szAppKey, szDlg, szTitle, nSdSelectFolder );
1002. SilentWriteData( szAppKey, "szFolder", DATA_STRING, svDefGroup, 0 );
1003. SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
1004. endif;
1005.
1006. return nId;
1007.
1008.end;