Annotation of mstools/mssetup/bldcui/dlgprocs.c, revision 1.1

1.1     ! root        1: /***************************************************************************/
        !             2: /*********************  Sample Dialog Procedures  **************************/
        !             3: /***************************************************************************/
        !             4: 
        !             5: #include "cui.h"
        !             6: #include "dialogs.h"
        !             7: #include <stdlib.h>
        !             8: #include <ctype.h>
        !             9: 
        !            10: 
        !            11: #define iszBMax    11
        !            12: #define INT_MAX    32767     /* maximum (signed) int value */
        !            13: #define cbSymBuf   1024
        !            14: #define cbNameMax  52
        !            15: 
        !            16: 
        !            17: LPSTR  _sz = NULL;
        !            18: 
        !            19: #define  FSingleByteCharSz(sz)  ((BOOL)(((_sz = (sz)) != NULL) \
        !            20:                                                                        && AnsiNext((LPSTR)(_sz)) == _sz + 1))
        !            21: 
        !            22: int   FAR PASCAL LibMain(HANDLE, WORD, WORD, LPSTR);
        !            23: int   FAR PASCAL WEP (int);
        !            24: LPSTR FAR PASCAL SzLastChar(LPSTR);
        !            25: LPSTR FAR PASCAL SzDlgEvent(WORD);
        !            26: int   FAR PASCAL AsciiToInt(LPSTR);
        !            27: LPSTR FAR PASCAL IntToAscii(int, LPSTR);
        !            28: 
        !            29: 
        !            30: 
        !            31: /*
        !            32: **     Purpose:
        !            33: **             CheckBox Dialog procedure for templates with one to ten checkbox
        !            34: **             controls.
        !            35: **
        !            36: **     Controls Recognized:
        !            37: **             Checkbox   - IDC_B1 to IDC_B10 (sequential)
        !            38: **             Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
        !            39: **
        !            40: **     Initialization Symbols:
        !            41: **             "CheckItemsIn" - list of "ON" and "OFF" string items for setting
        !            42: **                     the intial state of the checkbox controls, evaluated in
        !            43: **                     sequence ("ON" for checked, "OFF" for unchecked).  If there
        !            44: **                     are more controls than items, extra controls are left unchecked.
        !            45: **                     If there are fewer items than controls, extra items are ignored.
        !            46: **             "OptionsGreyed" - list of (one-based) indexes of checkboxes to be
        !            47: **                     initialized as disabled.  Indexes not in the list will be
        !            48: **                     left enabled.
        !            49: **
        !            50: **     Termination Symbols:
        !            51: **             "CheckItemsOut" - list of same format as "CheckItemsIn" representing
        !            52: **                     state of checkbox controls upon return.
        !            53: **             "DLGEVENT" - one of the following, according to control event:
        !            54: **                             event     value
        !            55: **                             -------   -------
        !            56: **                             IDC_B     "BACK"
        !            57: **                             IDC_C     "CONTINUE"
        !            58: **                             IDC_X     "EXIT"
        !            59: **                             IDCANCEL  "CANCEL"
        !            60: **
        !            61: **     Note:
        !            62: **             Pushbutton IDC_H will open the related Help dialog, if any.
        !            63: **
        !            64: *****************************************************************************/
        !            65: BOOL FAR PASCAL FCheckDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !            66: {
        !            67:        WORD idc, cb, i, cItems;
        !            68:        char szSymBuf[cbSymBuf];
        !            69: 
        !            70:        switch (wMsg)
        !            71:                {
        !            72:        case WM_INITDIALOG:
        !            73:                cItems = UsGetListLength("CheckItemsIn");
        !            74:                idc = IDC_B1;
        !            75:                for (i = 1; i <= cItems; ++i)
        !            76:                        {
        !            77:                        WORD wCheck = 0;
        !            78: 
        !            79:                        cb = CbGetListItem("CheckItemsIn", i, szSymBuf, cbSymBuf);
        !            80:                        Assert(cb < cbSymBuf);
        !            81:                        if (lstrcmp(szSymBuf, "ON") == 0)
        !            82:                                wCheck = 1;
        !            83:                        CheckDlgButton(hdlg, idc++, wCheck);
        !            84:                        }
        !            85: 
        !            86:                cItems = UsGetListLength("OptionsGreyed");
        !            87:                idc = IDC_B1;
        !            88:                for (i = 1; i <= cItems; ++i)
        !            89:                        {
        !            90:                        int iOpt;
        !            91: 
        !            92:                        cb = CbGetListItem("OptionsGreyed", i, szSymBuf, cbSymBuf);
        !            93:                        Assert(cb < cbSymBuf);
        !            94:                        iOpt  = AsciiToInt((LPSTR)szSymBuf);
        !            95:                        if (iOpt > 0
        !            96:                                        && iOpt <= 10)
        !            97:                                EnableWindow(GetDlgItem(hdlg, IDC_B0 + iOpt), 0);
        !            98:                        else if (*szSymBuf != '\0')
        !            99:                                Assert(fFalse);
        !           100:                        }
        !           101:                return(fTrue);
        !           102: 
        !           103:        case STF_REINITDIALOG:
        !           104:        case STF_ACTIVATEAPP:
        !           105:                return(fTrue);
        !           106: 
        !           107:        case WM_COMMAND:
        !           108:                switch (wParam)
        !           109:                        {
        !           110:                case IDC_B1:
        !           111:                case IDC_B2:
        !           112:                case IDC_B3:
        !           113:                case IDC_B4:
        !           114:                case IDC_B5:
        !           115:                case IDC_B6:
        !           116:                case IDC_B7:
        !           117:                case IDC_B8:
        !           118:                case IDC_B9:
        !           119:                case IDC_B10:
        !           120:                        CheckDlgButton(hdlg, wParam,
        !           121:                                        (WORD)!IsDlgButtonChecked(hdlg, wParam));
        !           122:                        break;
        !           123: 
        !           124:                case IDC_H:
        !           125:                        HdlgShowHelp();
        !           126:                        return(fTrue);
        !           127: 
        !           128:                case IDC_B:
        !           129:                case IDC_C:
        !           130:                case IDC_X:
        !           131:                case IDCANCEL:
        !           132:                        if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
        !           133:                                {
        !           134:                                DestroyWindow(GetParent(hdlg));
        !           135:                                return(fTrue);
        !           136:                                }
        !           137: 
        !           138:                        FRemoveSymbol("CheckItemsOut");
        !           139:                        for (idc = IDC_B1; GetDlgItem(hdlg, idc); idc++)
        !           140:                                if (!FAddListItem("CheckItemsOut",
        !           141:                                                IsDlgButtonChecked(hdlg, idc) ? "ON" : "OFF"))
        !           142:                                        {
        !           143:                                        DestroyWindow(GetParent(hdlg));
        !           144:                                        return(fFalse);
        !           145:                                        }
        !           146:                        Assert((unsigned)(idc-IDC_B1+1) <= iszBMax);
        !           147: 
        !           148:                        ReactivateSetupScript();
        !           149:                        break;
        !           150:                        }
        !           151:                break;
        !           152:                }
        !           153: 
        !           154:        return(fFalse);
        !           155: }
        !           156: 
        !           157: 
        !           158: 
        !           159: /*
        !           160: **     Purpose:
        !           161: **             Custom Install Dialog procedure for templates with one to ten custom
        !           162: **             options each consisting of at least one checkbox with an optional
        !           163: **             sub-option pushbutton or status string.  The dialog also supports
        !           164: **             an install path set button, display of the current install path, and
        !           165: **             display of the current disk space status.
        !           166: **
        !           167: **     Controls Recognized:
        !           168: **             Checkbox   - IDC_B1 to IDC_B10
        !           169: **                     with optionaly assocated buttons or text:
        !           170: **                     Pushbutton - IDC_SP1 to IDC_SP10
        !           171: **                     Text       - IDC_STATUS1 to IDC_STATUS10
        !           172: **             Pushbutton - IDC_B, IDC_C, IDC_H, IDC_P, IDC_X
        !           173: **             Text       - IDC_TEXT1 through IDC_TEXT7
        !           174: **
        !           175: **     Initialization Symbols:
        !           176: **             "CheckItemsState" - list of "ON" and "OFF" string items for setting
        !           177: **                     the intial state of the checkbox controls, evaluated in
        !           178: **                     sequence ("ON" for checked, "OFF" for unchecked).  If there
        !           179: **                     are more controls than items, extra controls are left unchecked.
        !           180: **                     If there are fewer items than controls, extra items are ignored.
        !           181: **             "StatusItemsText" - list of strings to initialize status text items
        !           182: **                     associated with checkboxes.
        !           183: **             "DriveStatusText" - list of seven strings to initialize drive status
        !           184: **                     text items (IDC_TEXT1-7) in the following sequence:
        !           185: **                             dst_drive, dst_space_need, dst_space_free,
        !           186: **                             win_drive, win_space_need, win_space_free,
        !           187: **                             dst_path
        !           188: **                     If any of the "win_" items is an empty string, its label
        !           189: **                     text will be made non-visible.
        !           190: **
        !           191: **     Termination Symbols:
        !           192: **             "CheckItemsState" - state of checkbox items (same format as above).
        !           193: **             "DLGEVENT" - one of the following, depending on event:
        !           194: **                             event                value
        !           195: **                             ----------           ----------
        !           196: **                             IDC_B                "BACK"
        !           197: **                             IDC_C                "CONTINUE"
        !           198: **                             IDC_P                "PATH"
        !           199: **                             IDC_X                "EXIT"
        !           200: **                             IDC_B1  to IDC_B10   "CHK1" to "CHK10"
        !           201: **                             IDC_SP1 to IDC_SP10  "BTN1" to "BTN10"
        !           202: **                             IDCANCEL             "CANCEL"
        !           203: **                             STF_ACTIVATEAPP      "REACTIVATE"
        !           204: **
        !           205: **     Note:
        !           206: **             Pushbutton IDC_H will open the related Help dialog, if any.
        !           207: **
        !           208: *****************************************************************************/
        !           209: BOOL FAR PASCAL FCustInstDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !           210: {
        !           211:        char  rgchChk[10];
        !           212:        char  rgchBtn[10];
        !           213:        WORD  idc;
        !           214:        WORD  cItems;
        !           215:        WORD  i, cb;
        !           216:        char  szSymBuf[cbSymBuf];
        !           217:        LPSTR szEvent;
        !           218: 
        !           219:        switch (wMsg)
        !           220:                {
        !           221:        case STF_ACTIVATEAPP:
        !           222:                if (!FSetSymbolValue("DLGEVENT", "REACTIVATE"))
        !           223:                        {
        !           224:                        DestroyWindow(GetParent(hdlg));
        !           225:                        return(fTrue);
        !           226:                        }
        !           227:                ReactivateSetupScript();
        !           228:                return(fTrue);
        !           229: 
        !           230:        case STF_REINITDIALOG:
        !           231:        case WM_INITDIALOG:
        !           232:                cItems = UsGetListLength("CheckItemsState");
        !           233:                idc = IDC_B1;
        !           234:                for (i = 1; i <= cItems; ++i)
        !           235:                        {
        !           236:                        WORD wCheck = 0;
        !           237: 
        !           238:                        cb = CbGetListItem("CheckItemsState", i, szSymBuf, cbSymBuf);
        !           239:                        Assert(cb < cbSymBuf);
        !           240:                        if (lstrcmp(szSymBuf, "ON") == 0)
        !           241:                                wCheck = 1;
        !           242:                        CheckDlgButton(hdlg, idc++, wCheck);
        !           243:                        }
        !           244: 
        !           245:                cItems = UsGetListLength("StatusItemsText");
        !           246:                idc = IDC_STATUS1;
        !           247:                for (i = 1; i <= cItems; ++i)
        !           248:                        {
        !           249:                        WORD wCheck = 0;
        !           250: 
        !           251:                        cb = CbGetListItem("StatusItemsText", i, szSymBuf, cbSymBuf);
        !           252:                        Assert(cb < cbSymBuf);
        !           253:                        SetDlgItemText(hdlg, idc++, szSymBuf);
        !           254:                        }
        !           255: 
        !           256:                cItems = UsGetListLength("DriveStatusText");
        !           257:                idc = IDC_TEXT1;
        !           258:                for (i = 1; i <= cItems; ++i)
        !           259:                        {
        !           260:                        WORD wCheck = 0;
        !           261: 
        !           262:                        cb = CbGetListItem("DriveStatusText", i, szSymBuf, cbSymBuf);
        !           263:                        Assert(cb < cbSymBuf);
        !           264:                        SetDlgItemText(hdlg, idc++, szSymBuf);
        !           265:                        if (i >= 4
        !           266:                                        && i <= 6)
        !           267:                                {
        !           268:                                if (*szSymBuf == '\0')
        !           269:                                        ShowWindow(GetDlgItem(hdlg, IDC_TEXT4+i), SW_HIDE);
        !           270:                                else
        !           271:                                        ShowWindow(GetDlgItem(hdlg, IDC_TEXT4+i), SW_SHOWNOACTIVATE);
        !           272:                                }
        !           273:                        }
        !           274: 
        !           275:                return(fTrue);
        !           276: 
        !           277:        case WM_COMMAND:
        !           278:                switch(wParam)
        !           279:                        {
        !           280:                default:
        !           281:                        szEvent = (LPSTR)NULL;
        !           282:                        break;
        !           283: 
        !           284:                case IDC_B1:
        !           285:                case IDC_B2:
        !           286:                case IDC_B3:
        !           287:                case IDC_B4:
        !           288:                case IDC_B5:
        !           289:                case IDC_B6:
        !           290:                case IDC_B7:
        !           291:                case IDC_B8:
        !           292:                case IDC_B9:
        !           293:                case IDC_B10:
        !           294:                        lstrcpy((LPSTR)rgchChk, "CHK");
        !           295:                        IntToAscii((int)(wParam-IDC_B1+1), (LPSTR)(&rgchChk[3]));
        !           296:                        szEvent = (LPSTR)rgchChk;
        !           297:                        break;
        !           298: 
        !           299:                case IDC_SP1:
        !           300:                case IDC_SP2:
        !           301:                case IDC_SP3:
        !           302:                case IDC_SP4:
        !           303:                case IDC_SP5:
        !           304:                case IDC_SP6:
        !           305:                case IDC_SP7:
        !           306:                case IDC_SP8:
        !           307:                case IDC_SP9:
        !           308:                case IDC_SP10:
        !           309:                        lstrcpy((LPSTR)rgchBtn, "BTN");
        !           310:                        IntToAscii((int)(wParam-IDC_SP1+1), (LPSTR)(&rgchBtn[3]));
        !           311:                        szEvent = (LPSTR)rgchBtn;
        !           312:                        break;
        !           313: 
        !           314:                case IDOK:
        !           315:                        wParam = IDC_C;
        !           316:                case IDC_B:
        !           317:                case IDC_C:
        !           318:                case IDC_X:
        !           319:                case IDCANCEL:
        !           320:                        szEvent = SzDlgEvent(wParam);
        !           321:                        Assert(szEvent != NULL);
        !           322:                        break;
        !           323: 
        !           324:                case IDC_P:
        !           325:                        szEvent = "PATH";
        !           326:                        break;
        !           327: 
        !           328:                case IDC_H:
        !           329:                        HdlgShowHelp();
        !           330:                        return(fTrue);
        !           331: 
        !           332:                        }
        !           333: 
        !           334:                if (szEvent == (LPSTR)NULL)
        !           335:                        break;
        !           336: 
        !           337:                FRemoveSymbol("CheckItemsState");
        !           338:                for (idc = IDC_B1; GetDlgItem(hdlg, idc); idc++)
        !           339:                        if (!FAddListItem("CheckItemsState",
        !           340:                                        IsDlgButtonChecked(hdlg, idc) ? "ON" : "OFF"))
        !           341:                                {
        !           342:                                DestroyWindow(GetParent(hdlg));
        !           343:                                return(fFalse);
        !           344:                                }
        !           345:                Assert((unsigned)(idc-IDC_B1+1) <= iszBMax);
        !           346: 
        !           347:                if (szEvent != (LPSTR)NULL)
        !           348:                        if (!FSetSymbolValue("DLGEVENT", szEvent))
        !           349:                                {
        !           350:                                DestroyWindow(GetParent(hdlg));
        !           351:                                return(fTrue);
        !           352:                                }
        !           353: 
        !           354:                ReactivateSetupScript();
        !           355:                break;
        !           356:                }
        !           357: 
        !           358:        return(fFalse);
        !           359: }
        !           360: 
        !           361: 
        !           362: 
        !           363: /*
        !           364: **     Purpose:
        !           365: **             Edit Dialog procedure for templates with one Edit control.
        !           366: **             (Limits the input string length to cbFullPathMax characters.)
        !           367: **
        !           368: **     Controls Recognized:
        !           369: **             Edit       - IDC_EDIT
        !           370: **             Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
        !           371: **
        !           372: **     Initialization Symbols:
        !           373: **             "EditTextIn" - initial text for IDC_EDIT edit control.
        !           374: **             "EditFocus"  - position of intial focus for text string:
        !           375: **                             "END" (default), "ALL", or "START"
        !           376: **
        !           377: **     Termination Symbols:
        !           378: **             "EditTextOut" - text in the IDC_EDIT edit control upon termination.
        !           379: **             "DLGEVENT"    - one of the following, depending on event:
        !           380: **                             event                value
        !           381: **                             ----------           ----------
        !           382: **                             IDC_B                "BACK"
        !           383: **                             IDC_C                "CONTINUE"
        !           384: **                             IDC_X                "EXIT"
        !           385: **                             IDCANCEL             "CANCEL"
        !           386: **                             STF_ACTIVATEAPP      "REACTIVATE"
        !           387: **
        !           388: **     Note:
        !           389: **             Pushbutton IDC_H will open the related Help dialog, if any.
        !           390: **
        !           391: *****************************************************************************/
        !           392: BOOL FAR PASCAL FEditDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !           393: {
        !           394:        static WORD wSelStart = 0;
        !           395:        static WORD wSelEnd   = 0;
        !           396:        char  rgchText[cbFullPathMax + 1];
        !           397:        WORD  cbLen;
        !           398:        WORD  cb;
        !           399:        char  szSymBuf[cbFullPathMax + 1];
        !           400: 
        !           401:        switch (wMsg)
        !           402:                {
        !           403:        case STF_ACTIVATEAPP:
        !           404:                if (!FSetSymbolValue("DLGEVENT", "REACTIVATE"))
        !           405:                        {
        !           406:                        DestroyWindow(GetParent(hdlg));
        !           407:                        return(fTrue);
        !           408:                        }
        !           409:                ReactivateSetupScript();
        !           410:                return(fTrue);
        !           411: 
        !           412:        case WM_INITDIALOG:
        !           413:                cb = CbGetSymbolValue("EditTextIn", szSymBuf, cbFullPathMax + 1);
        !           414:                Assert(cb < cbFullPathMax + 1);
        !           415:                SendDlgItemMessage(hdlg, IDC_EDIT, EM_LIMITTEXT, cbFullPathMax, 0L);
        !           416:                SetDlgItemText(hdlg, IDC_EDIT, (LPSTR)szSymBuf);
        !           417: 
        !           418:                cbLen = lstrlen(szSymBuf);
        !           419:                cb = CbGetSymbolValue("EditFocus", szSymBuf, cbFullPathMax + 1);
        !           420:                Assert(cb < cbFullPathMax + 1);
        !           421: 
        !           422:                if (lstrcmp(szSymBuf, "ALL") == 0)
        !           423:                        {
        !           424:                        wSelStart = 0;
        !           425:                        wSelEnd   = INT_MAX;
        !           426:                        }
        !           427:                else if (lstrcmp(szSymBuf, "START") == 0)
        !           428:                        {
        !           429:                        wSelStart = 0;
        !           430:                        wSelEnd   = 0;
        !           431:                        }
        !           432:                else       /* default == END */
        !           433:                        {
        !           434:                        wSelStart = (WORD)cbLen;
        !           435:                        wSelEnd   = (WORD)cbLen;
        !           436:                        }
        !           437:                return(fTrue);
        !           438: 
        !           439:        case STF_REINITDIALOG:
        !           440:                SendDlgItemMessage(hdlg, IDC_EDIT, EM_SETSEL, 0, MAKELONG(256, 256));
        !           441:                SetFocus(GetDlgItem(hdlg, IDC_EDIT));
        !           442:                return(fTrue);
        !           443: 
        !           444:        case WM_COMMAND:
        !           445:                switch(wParam)
        !           446:                        {
        !           447:                case IDC_EDIT:
        !           448:                        if (HIWORD(lParam) == EN_SETFOCUS)
        !           449:                                SendDlgItemMessage(hdlg, IDC_EDIT, EM_SETSEL, 0,
        !           450:                                                MAKELONG(wSelStart, wSelEnd));
        !           451:                        else if (HIWORD(lParam) == EN_KILLFOCUS)
        !           452:                                {
        !           453:                                LONG  l = SendDlgItemMessage(hdlg, IDC_EDIT, EM_GETSEL, 0, 0L);
        !           454: 
        !           455:                                wSelStart = LOWORD(l);
        !           456:                                wSelEnd   = HIWORD(l);
        !           457:                                }
        !           458:                        break;
        !           459: 
        !           460:                case IDC_H:
        !           461:                        HdlgShowHelp();
        !           462:                        return(fTrue);
        !           463: 
        !           464:                case IDC_B:
        !           465:                case IDC_C:
        !           466:                case IDC_X:
        !           467:                case IDCANCEL:
        !           468:                        if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
        !           469:                                {
        !           470:                                DestroyWindow(GetParent(hdlg));
        !           471:                                return(fTrue);
        !           472:                                }
        !           473:                        SendDlgItemMessage(hdlg, IDC_EDIT, (WORD)WM_GETTEXT,
        !           474:                                        cbFullPathMax + 1, (LONG)((LPSTR)rgchText));
        !           475:                        if (!FSetSymbolValue("EditTextOut", rgchText))
        !           476:                                {
        !           477:                                DestroyWindow(GetParent(hdlg));
        !           478:                                return(fTrue);
        !           479:                                }
        !           480:                        ReactivateSetupScript();
        !           481:                        break;
        !           482:                        }
        !           483:                break;
        !           484:                }
        !           485: 
        !           486:        return(fFalse);
        !           487: }
        !           488: 
        !           489: 
        !           490: 
        !           491: /*
        !           492: **     Purpose:
        !           493: **             Help Dialog procedure.
        !           494: **
        !           495: **     Controls Recognized:
        !           496: **             Pushbutton - IDC_X.
        !           497: **
        !           498: **     Initialization Symbols:
        !           499: **             none.
        !           500: **
        !           501: **     Termination Symbols:
        !           502: **             none. (Handles IDC_X and IDCANCEL events by calling FCloseHelp.)
        !           503: **
        !           504: **     Note:
        !           505: **             This dialog proc is for Help dialogs ONLY (szHelpProc$ parameter
        !           506: **             of UIStartDlg) and CANNOT be used as the szDlgProc$ parameter
        !           507: **             of the UIStartDlg MSSetup script function.
        !           508: **
        !           509: *****************************************************************************/
        !           510: BOOL FAR PASCAL FHelpDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !           511: {
        !           512:        switch (wMsg)
        !           513:                {
        !           514:        case WM_INITDIALOG:
        !           515:                return(fTrue);
        !           516: 
        !           517:        case STF_REINITDIALOG:
        !           518:                return(fTrue);
        !           519: 
        !           520:        case STF_ACTIVATEAPP:
        !           521:                /* Help dlg should not be on the dlg stack
        !           522:                ** and should never get this message.
        !           523:                */
        !           524:                Assert(fFalse);
        !           525:                return(fTrue);
        !           526: 
        !           527:        case WM_COMMAND:
        !           528:                if (wParam != IDC_X
        !           529:                        && wParam != IDCANCEL)
        !           530:                        break;
        !           531:                FCloseHelp();
        !           532:                return(fTrue);
        !           533: 
        !           534:                }
        !           535:        return(fFalse);
        !           536: }
        !           537: 
        !           538: 
        !           539: 
        !           540: /*
        !           541: **     Purpose:
        !           542: **             Information Dialog procedure.
        !           543: **
        !           544: **     Controls Recognized:
        !           545: **             Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
        !           546: **
        !           547: **     Initialization Symbols:
        !           548: **             none.
        !           549: **
        !           550: **     Termination Symbols:
        !           551: **             "DLGEVENT" - one of the following, according to control event:
        !           552: **                             event     value
        !           553: **                             -------   -------
        !           554: **                             IDC_B     "BACK"
        !           555: **                             IDC_C     "CONTINUE"
        !           556: **                             IDC_X     "EXIT"
        !           557: **                             IDCANCEL  "CANCEL"
        !           558: **
        !           559: **     Note:
        !           560: **             Pushbutton IDC_H will open the related Help dialog, if any.
        !           561: **
        !           562: *****************************************************************************/
        !           563: BOOL FAR PASCAL FInfoDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !           564: {
        !           565:        switch (wMsg)
        !           566:                {
        !           567:        case WM_INITDIALOG:
        !           568:                return(fTrue);
        !           569: 
        !           570:        case STF_REINITDIALOG:
        !           571:        case STF_ACTIVATEAPP:
        !           572:                return(fTrue);
        !           573: 
        !           574:        case WM_COMMAND:
        !           575:                switch (wParam)
        !           576:                        {
        !           577:                case IDC_H:
        !           578:                        HdlgShowHelp();
        !           579:                        return(fTrue);
        !           580: 
        !           581:                case IDC_B:
        !           582:                case IDC_C:
        !           583:                case IDC_X:
        !           584:                case IDCANCEL:
        !           585:                        if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
        !           586:                                {
        !           587:                                DestroyWindow(GetParent(hdlg));
        !           588:                                return(fTrue);
        !           589:                                }
        !           590:                        ReactivateSetupScript();
        !           591:                        break;
        !           592:                        }
        !           593:                break;
        !           594:                }
        !           595: 
        !           596:        return(fFalse);
        !           597: }
        !           598: 
        !           599: 
        !           600: 
        !           601: /*
        !           602: **     Purpose:
        !           603: **             Information Dialog procedure, without "Exit" button.
        !           604: **
        !           605: **     Controls Recognized:
        !           606: **             Pushbutton - IDC_B, IDC_C, IDC_H
        !           607: **
        !           608: **     Initialization Symbols:
        !           609: **             none.
        !           610: **
        !           611: **     Termination Symbols:
        !           612: **             "DLGEVENT" - one of the following, depending on event:
        !           613: **                             event                value
        !           614: **                             ----------           ----------
        !           615: **                             IDC_B                "BACK"
        !           616: **                             IDC_C                "CONTINUE"
        !           617: **                             IDCANCEL             "CANCEL"
        !           618: **                             STF_ACTIVATEAPP      "REACTIVATE"
        !           619: **
        !           620: **     Note:
        !           621: **             Pushbutton IDC_H will open the related Help dialog, if any.
        !           622: **
        !           623: *****************************************************************************/
        !           624: BOOL FAR PASCAL FInfo0DlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !           625: {
        !           626:        switch (wMsg)
        !           627:                {
        !           628:        case WM_INITDIALOG:
        !           629:                return(fTrue);
        !           630: 
        !           631:        case STF_REINITDIALOG:
        !           632:                return(fTrue);
        !           633: 
        !           634:        case STF_ACTIVATEAPP:
        !           635:                if (!FSetSymbolValue("DLGEVENT", "REACTIVATE"))
        !           636:                        {
        !           637:                        DestroyWindow(GetParent(hdlg));
        !           638:                        return(fTrue);
        !           639:                        }
        !           640:                ReactivateSetupScript();
        !           641:                return(fTrue);
        !           642: 
        !           643:        case WM_COMMAND:
        !           644:                switch (wParam)
        !           645:                        {
        !           646:                case IDC_H:
        !           647:                        HdlgShowHelp();
        !           648:                        return(fTrue);
        !           649: 
        !           650:                case IDC_B:
        !           651:                case IDC_C:
        !           652:                case IDCANCEL:
        !           653:                        if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
        !           654:                                {
        !           655:                                DestroyWindow(GetParent(hdlg));
        !           656:                                return(fTrue);
        !           657:                                }
        !           658:                        ReactivateSetupScript();
        !           659:                        break;
        !           660:                        }
        !           661:                break;
        !           662:                }
        !           663: 
        !           664:        return(fFalse);
        !           665: }
        !           666: 
        !           667: 
        !           668: 
        !           669: /*
        !           670: **     Purpose:
        !           671: **             Single Choice Listbox Dialog procedure for templates with exactly one
        !           672: **             listbox control.
        !           673: **
        !           674: **     Controls Recognized:
        !           675: **             Listbox    - IDC_LIST1
        !           676: **             Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
        !           677: **
        !           678: **     Initialization Symbols:
        !           679: **             "ListItemsIn"  - list of strings to put in the listbox.
        !           680: **             "ListItemsOut" - simple string (not a list) representing an
        !           681: **                     initial selection in "ListItemsIn".
        !           682: **
        !           683: **     Termination Symbols:
        !           684: **             "ListItemsOut" - selected list item string.
        !           685: **             "DLGEVENT"     - one of the following, according to control event:
        !           686: **                             event     value
        !           687: **                             -------   -------
        !           688: **                             IDC_B     "BACK"
        !           689: **                             IDC_C     "CONTINUE"
        !           690: **                             IDC_X     "EXIT"
        !           691: **                             IDCANCEL  "CANCEL"
        !           692: **
        !           693: **     Note:
        !           694: **             Pushbutton IDC_H will open the related Help dialog, if any.
        !           695: **
        !           696: *****************************************************************************/
        !           697: BOOL FAR PASCAL FListDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !           698: {
        !           699:        char szListIn[cbSymBuf];
        !           700:        char szListOut[cbSymBuf];
        !           701:        WORD iItem;
        !           702:        WORD cb, i;
        !           703:        WORD cItems;
        !           704: 
        !           705:        switch (wMsg)
        !           706:                {
        !           707:        case WM_INITDIALOG:
        !           708:                cItems = UsGetListLength("ListItemsIn");
        !           709:                for (i = 1; i <= cItems; ++i)
        !           710:                        {
        !           711:                        cb = CbGetListItem("ListItemsIn", i, szListIn, cbSymBuf);
        !           712:                        Assert(cb < cbSymBuf);
        !           713:                        SendDlgItemMessage(hdlg, IDC_LIST1, LB_ADDSTRING, 0,
        !           714:                                        (LONG)(LPSTR)szListIn);
        !           715:                        }
        !           716: 
        !           717:                cb = CbGetSymbolValue("ListItemsOut", szListOut, cbSymBuf);
        !           718:                Assert(cb < cbSymBuf);
        !           719:                if (cb == 0)
        !           720:                        SendDlgItemMessage(hdlg, IDC_LIST1, LB_SETCURSEL, (WORD)-1, 0L);
        !           721:                else
        !           722:                        {
        !           723:                        for (i = 1, iItem = 0; i <= cItems; ++i, ++iItem)
        !           724:                                {
        !           725:                                cb = CbGetListItem("ListItemsIn", i, szListIn, cbSymBuf);
        !           726:                                Assert(cb < cbSymBuf);
        !           727:                                if (lstrcmp(szListOut, szListIn) == 0)
        !           728:                                        {
        !           729:                                        SendDlgItemMessage(hdlg,IDC_LIST1,LB_SETCURSEL,iItem,0L);
        !           730:                                        break;
        !           731:                                        }
        !           732:                                }
        !           733:                        }
        !           734: 
        !           735:                /* Note: Depends on number of lines in list box.
        !           736:                */
        !           737:                if (iItem < 4)
        !           738:                        iItem = 0;
        !           739:                SendDlgItemMessage(hdlg, IDC_LIST1, LB_SETTOPINDEX, iItem, 0L);
        !           740: 
        !           741:                return(fTrue);
        !           742: 
        !           743:        case STF_REINITDIALOG:
        !           744:        case STF_ACTIVATEAPP:
        !           745:                return(fTrue);
        !           746: 
        !           747:        case WM_COMMAND:
        !           748:                switch(wParam)
        !           749:                        {
        !           750:                case IDC_H:
        !           751:                        HdlgShowHelp();
        !           752:                        return(fTrue);
        !           753: 
        !           754:                case IDC_LIST1:
        !           755:                        if (HIWORD(lParam) != LBN_DBLCLK)
        !           756:                                break;
        !           757:                        wParam = IDC_C;
        !           758:                case IDC_B:
        !           759:                case IDC_C:
        !           760:                case IDC_X:
        !           761:                case IDCANCEL:
        !           762:                        if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
        !           763:                                {
        !           764:                                DestroyWindow(GetParent(hdlg));
        !           765:                                return(fTrue);
        !           766:                                }
        !           767: 
        !           768:                        if ((iItem = (WORD)SendDlgItemMessage(hdlg, IDC_LIST1, LB_GETCURSEL,
        !           769:                                                0, 0L)) == LB_ERR
        !           770:                                        || (cb = (WORD)SendDlgItemMessage(hdlg, IDC_LIST1,
        !           771:                                                        LB_GETTEXTLEN, iItem, 0L)) == LB_ERR)
        !           772:                                *szListOut = '\0';
        !           773:                        else
        !           774:                                {
        !           775:                                Assert(cb <= cbSymBuf);
        !           776:                                SendDlgItemMessage(hdlg, IDC_LIST1, LB_GETTEXT, iItem,
        !           777:                                                (LONG)(LPSTR)szListOut);
        !           778:                                }
        !           779:                        if (!FSetSymbolValue("ListItemsOut", szListOut))
        !           780:                                {
        !           781:                                DestroyWindow(GetParent(hdlg));
        !           782:                                return(fTrue);
        !           783:                                }
        !           784: 
        !           785:                        ReactivateSetupScript();
        !           786:                        break;
        !           787:                        }
        !           788:                break;
        !           789: 
        !           790:                }
        !           791: 
        !           792:        return(fFalse);
        !           793: }
        !           794: 
        !           795: 
        !           796: 
        !           797: /*
        !           798: **     Purpose:
        !           799: **             Modeless Dialog procedure.
        !           800: **
        !           801: **     Controls Recognized:
        !           802: **             none.
        !           803: **
        !           804: **     Initialization Symbols:
        !           805: **             none.
        !           806: **
        !           807: **     Termination Symbols:
        !           808: **             none.
        !           809: **
        !           810: **     Note:
        !           811: **             This dialog procedure is REQUIRED with use of any Billboard
        !           812: **             MSSetup script functions.
        !           813: **
        !           814: *****************************************************************************/
        !           815: BOOL FAR PASCAL FModelessDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !           816: {
        !           817:        switch (wMsg)
        !           818:                {
        !           819:        case WM_INITDIALOG:
        !           820:                ReactivateSetupScript();
        !           821:                return(fTrue);
        !           822: 
        !           823:        case STF_REINITDIALOG:
        !           824:        case STF_ACTIVATEAPP:
        !           825:                return(fTrue);
        !           826: 
        !           827:        case WM_CLOSE:
        !           828:        case WM_COMMAND:
        !           829:                Assert(fFalse);
        !           830:                break;
        !           831:                }
        !           832: 
        !           833:        return(fFalse);
        !           834: }
        !           835: 
        !           836: 
        !           837: 
        !           838: /*
        !           839: **     Purpose:
        !           840: **             Multiple Choice Listbox Dialog procedure for templates with
        !           841: **             exactly one listbox control.
        !           842: **
        !           843: **     Controls Recognized:
        !           844: **             Listbox    - IDC_LIST1
        !           845: **             Pushbutton - IDC_B, IDC_C, IDC_H, IDC_L, IDC_S, IDC_X
        !           846: **
        !           847: **     Initialization Symbols:
        !           848: **             "ListItemsIn"  - list of strings to put in the listbox.
        !           849: **             "ListItemsOut" - list of strings representing initial
        !           850: **                     selections in "ListItemsIn".
        !           851: **
        !           852: **     Termination Symbols:
        !           853: **             "ListItemsOut" - list of items selected (if any).
        !           854: **             "DLGEVENT"     - one of the following, according to control event:
        !           855: **                             event     value
        !           856: **                             -------   -------
        !           857: **                             IDC_B     "BACK"
        !           858: **                             IDC_C     "CONTINUE"
        !           859: **                             IDC_X     "EXIT"
        !           860: **                             IDCANCEL  "CANCEL"
        !           861: **
        !           862: **     Note:
        !           863: **             Pushbutton IDC_H will open the related Help dialog, if any.
        !           864: **             Pushbuttons IDC_L and IDC_S are for "clear all" and "select all"
        !           865: **             respectively.
        !           866: **
        !           867: *****************************************************************************/
        !           868: BOOL FAR PASCAL FMultiDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !           869: {
        !           870:        WORD i, j, nCount;
        !           871:        char szListIn[cbSymBuf];
        !           872:        char szListOut[cbSymBuf];
        !           873:        WORD iItem, iItemTop;
        !           874:        WORD cb;
        !           875:        WORD cItemsIn, cItemsOut;
        !           876: 
        !           877:        switch (wMsg)
        !           878:                {
        !           879:        case WM_INITDIALOG:
        !           880:                cItemsIn = UsGetListLength("ListItemsIn");
        !           881:                nCount = 0;
        !           882:                for (i = 1; i <= cItemsIn; ++i)
        !           883:                        {
        !           884:                        cb = CbGetListItem("ListItemsIn", i, szListIn, cbSymBuf);
        !           885:                        Assert(cb < cbSymBuf);
        !           886:                        SendDlgItemMessage(hdlg, IDC_LIST1, LB_ADDSTRING, 0,
        !           887:                                        (LONG)(LPSTR)szListIn);
        !           888:                        nCount++;
        !           889:                        }
        !           890:                Assert(nCount == (WORD)SendDlgItemMessage(hdlg, IDC_LIST1, LB_GETCOUNT,
        !           891:                                0, 0L));
        !           892: 
        !           893:                cItemsOut = UsGetListLength("ListItemsOut");
        !           894:                for (i = 1, iItemTop = 0; i <= cItemsOut; ++i, ++iItemTop)
        !           895:                        {
        !           896:                        cb = CbGetListItem("ListItemsOut", i, szListOut, cbSymBuf);
        !           897:                        Assert(cb < cbSymBuf);
        !           898:                        for (j = 1, iItem = 0; j <= cItemsIn; ++j, ++iItem)
        !           899:                                {
        !           900:                                cb = CbGetListItem("ListItemsIn", j, szListIn, cbSymBuf);
        !           901:                                Assert(cb < cbSymBuf);
        !           902:                                if (lstrcmp(szListOut, szListIn) == 0)
        !           903:                                        {
        !           904:                                        SendDlgItemMessage(hdlg, IDC_LIST1, LB_SETSEL, 1,
        !           905:                                                        MAKELONG(iItem, 0));
        !           906:                                        if (iItemTop == 0
        !           907:                                                        || (WORD)iItem < iItemTop)
        !           908:                                                iItemTop = (WORD)iItem;
        !           909:                                        break;
        !           910:                                        }
        !           911:                                }
        !           912:                        }
        !           913: 
        !           914:                /* Note: Depends on number of lines in list box.
        !           915:                */
        !           916:                if (iItemTop < 4)
        !           917:                        iItemTop = 0;
        !           918:                SendDlgItemMessage(hdlg, IDC_LIST1, LB_SETTOPINDEX, iItemTop, 0L);
        !           919: 
        !           920:                return(fTrue);
        !           921: 
        !           922:        case STF_REINITDIALOG:
        !           923:        case STF_ACTIVATEAPP:
        !           924:                return(fTrue);
        !           925: 
        !           926:        case WM_COMMAND:
        !           927:                switch(wParam)
        !           928:                        {
        !           929:                case IDC_S:
        !           930:                case IDC_L:
        !           931:                        SendDlgItemMessage(hdlg, IDC_LIST1, LB_SETSEL, (wParam == IDC_S),
        !           932:                                        -1L);
        !           933:                        break;
        !           934: 
        !           935:                case IDC_H:
        !           936:                        HdlgShowHelp();
        !           937:                        return(fTrue);
        !           938: 
        !           939:                case IDC_B:
        !           940:                case IDC_C:
        !           941:                case IDC_X:
        !           942:                case IDCANCEL:
        !           943:                        if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
        !           944:                                {
        !           945:                                DestroyWindow(GetParent(hdlg));
        !           946:                                return(fTrue);
        !           947:                                }
        !           948: 
        !           949:                        /* Note: Could be faster to use LB_GETSELITEMS here.
        !           950:                        */
        !           951:                        nCount = (WORD)SendDlgItemMessage(hdlg, IDC_LIST1, LB_GETCOUNT, 0,
        !           952:                                        0L);
        !           953: 
        !           954:                        FRemoveSymbol("ListItemsOut");
        !           955:                        for (i = 0; i < nCount; i++)
        !           956:                                {
        !           957:                                if (SendDlgItemMessage(hdlg, IDC_LIST1, LB_GETSEL, (WORD)i, 0L))
        !           958:                                        {
        !           959:                                        SendDlgItemMessage(hdlg, IDC_LIST1, LB_GETTEXT, (WORD)i,
        !           960:                                                        (LONG)(LPSTR)szListOut);
        !           961:                                        if (!FAddListItem("ListItemsOut", szListOut))
        !           962:                                                {
        !           963:                                                DestroyWindow(GetParent(hdlg));
        !           964:                                                return(fTrue);
        !           965:                                                }
        !           966:                                        }
        !           967:                                }
        !           968: 
        !           969:                        ReactivateSetupScript();
        !           970:                        break;
        !           971:                        }
        !           972:                break;
        !           973:                }
        !           974: 
        !           975:        return(fFalse);
        !           976: }
        !           977: 
        !           978: 
        !           979: 
        !           980: /*
        !           981: **     Purpose:
        !           982: **             Quit Dialog procedure.
        !           983: **
        !           984: **     Controls Recognized:
        !           985: **             Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
        !           986: **
        !           987: **     Initialization Symbols:
        !           988: **             none.
        !           989: **
        !           990: **     Termination Symbols:
        !           991: **             "DLGEVENT" - one of the following, depending on event:
        !           992: **                             event                value
        !           993: **                             ----------           ----------
        !           994: **                             IDC_B                "BACK"
        !           995: **                             IDC_C                "CONTINUE"
        !           996: **                             IDC_X                "EXIT"
        !           997: **                             IDCANCEL             "CANCEL"
        !           998: **                             STF_ACTIVATEAPP      "REACTIVATE"
        !           999: **
        !          1000: **     Note:
        !          1001: **             Pushbutton IDC_H will open the related Help dialog, if any.
        !          1002: **
        !          1003: *****************************************************************************/
        !          1004: BOOL FAR PASCAL FQuitDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !          1005: {
        !          1006:        switch (wMsg)
        !          1007:                {
        !          1008:        case WM_INITDIALOG:
        !          1009:                return(fTrue);
        !          1010: 
        !          1011:        case STF_REINITDIALOG:
        !          1012:                return(fTrue);
        !          1013: 
        !          1014:        case STF_ACTIVATEAPP:
        !          1015:                if (!FSetSymbolValue("DLGEVENT", "REACTIVATE"))
        !          1016:                        {
        !          1017:                        DestroyWindow(GetParent(hdlg));
        !          1018:                        return(fTrue);
        !          1019:                        }
        !          1020:                ReactivateSetupScript();
        !          1021:                return(fTrue);
        !          1022: 
        !          1023:        case WM_COMMAND:
        !          1024:                switch(wParam)
        !          1025:                        {
        !          1026:                case IDC_H:
        !          1027:                        HdlgShowHelp();
        !          1028:                        return(fTrue);
        !          1029: 
        !          1030:                case IDC_B:
        !          1031:                case IDC_C:
        !          1032:                case IDC_X:
        !          1033:                case IDCANCEL:
        !          1034:                        if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
        !          1035:                                {
        !          1036:                                DestroyWindow(GetParent(hdlg));
        !          1037:                                return(fTrue);
        !          1038:                                }
        !          1039: 
        !          1040:                        ReactivateSetupScript();
        !          1041:                        break;
        !          1042:                        }
        !          1043:                break;
        !          1044:                }
        !          1045:        return(fFalse);
        !          1046: }
        !          1047: 
        !          1048: 
        !          1049: 
        !          1050: /*
        !          1051: **     Purpose:
        !          1052: **             Radio Button Group Dialog procedure for templates with one group
        !          1053: **             of one to ten radio button controls.
        !          1054: **
        !          1055: **     Controls Recognized:
        !          1056: **             Radio      - IDC_B1 to IDC_B10 (sequential)
        !          1057: **             Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
        !          1058: **
        !          1059: **     Initialization Symbols:
        !          1060: **             "RadioDefault" - index (one-based) of radio button to be
        !          1061: **                     initialized as selected (default is "1").
        !          1062: **             "OptionsGreyed" - list of (one-based) indexes of radio buttons
        !          1063: **                     to be initialized as disabled.  Indexes not in the list will
        !          1064: **                     be left enabled.
        !          1065: **
        !          1066: **     Termination Symbols:
        !          1067: **             "ButtonChecked" - index of currently selected radio button.
        !          1068: **             "DLGEVENT"      - one of the following, depending on event:
        !          1069: **                             event                value
        !          1070: **                             ----------           ----------
        !          1071: **                             IDC_B                "BACK"
        !          1072: **                             IDC_C                "CONTINUE"
        !          1073: **                             IDC_X                "EXIT"
        !          1074: **                             IDCANCEL             "CANCEL"
        !          1075: **                             STF_ACTIVATEAPP      "REACTIVATE"
        !          1076: **
        !          1077: **     Note:
        !          1078: **             Pushbutton IDC_H will open the related Help dialog, if any.
        !          1079: **
        !          1080: *****************************************************************************/
        !          1081: BOOL FAR PASCAL FRadioDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !          1082: {
        !          1083:        char rgchNum[10];
        !          1084:        int  iButtonChecked;
        !          1085:        char szSymBuf[cbSymBuf];
        !          1086:        WORD i, cb, cItems, idc;
        !          1087: 
        !          1088:        switch (wMsg)
        !          1089:                {
        !          1090:        case STF_ACTIVATEAPP:
        !          1091:                if (!FSetSymbolValue("DLGEVENT", "REACTIVATE"))
        !          1092:                        {
        !          1093:                        DestroyWindow(GetParent(hdlg));
        !          1094:                        return(fTrue);
        !          1095:                        }
        !          1096:                ReactivateSetupScript();
        !          1097:                return(fTrue);
        !          1098: 
        !          1099:        case WM_INITDIALOG:
        !          1100:                cb = CbGetSymbolValue("RadioDefault", szSymBuf, cbSymBuf);
        !          1101:                Assert(cb < cbSymBuf);
        !          1102:                if (*szSymBuf != '\0')
        !          1103:                        {
        !          1104:                        iButtonChecked = AsciiToInt((LPSTR)szSymBuf);
        !          1105:                        if (iButtonChecked < 1)
        !          1106:                                iButtonChecked = 0;
        !          1107:                        if (iButtonChecked > 10)
        !          1108:                                iButtonChecked = 10;
        !          1109:                        }
        !          1110:                else
        !          1111:                        iButtonChecked = 1;
        !          1112: 
        !          1113:                if (iButtonChecked != 0)
        !          1114:                        SendDlgItemMessage(hdlg, IDC_B0 + iButtonChecked, BM_SETCHECK,1,0L);
        !          1115: 
        !          1116:                cItems = UsGetListLength("OptionsGreyed");
        !          1117:                idc = IDC_B1;
        !          1118:                for (i = 1; i <= cItems; ++i)
        !          1119:                        {
        !          1120:                        int iOpt;
        !          1121: 
        !          1122:                        cb = CbGetListItem("OptionsGreyed", i, szSymBuf, cbSymBuf);
        !          1123:                        Assert(cb < cbSymBuf);
        !          1124:                        iOpt  = AsciiToInt((LPSTR)szSymBuf);
        !          1125:                        if (iOpt > 0
        !          1126:                                        && iOpt <= 10
        !          1127:                                        && iOpt != iButtonChecked)
        !          1128:                                EnableWindow(GetDlgItem(hdlg, IDC_B0 + iOpt), 0);
        !          1129:                        else if (*szSymBuf != '\0')
        !          1130:                                Assert(fFalse);
        !          1131:                        }
        !          1132:                return(fTrue);
        !          1133: 
        !          1134:        case STF_REINITDIALOG:
        !          1135:                return(fTrue);
        !          1136: 
        !          1137:        case WM_COMMAND:
        !          1138:                switch (wParam)
        !          1139:                        {
        !          1140:                case IDC_H:
        !          1141:                        HdlgShowHelp();
        !          1142:                        return(fTrue);
        !          1143: 
        !          1144:                case IDC_B1:
        !          1145:                case IDC_B2:
        !          1146:                case IDC_B3:
        !          1147:                case IDC_B4:
        !          1148:                case IDC_B5:
        !          1149:                case IDC_B6:
        !          1150:                case IDC_B7:
        !          1151:                case IDC_B8:
        !          1152:                case IDC_B9:
        !          1153:                case IDC_B10:
        !          1154:                        CheckRadioButton(hdlg, IDC_B1, IDC_B10, wParam);
        !          1155:                        if (HIWORD(lParam) != BN_DOUBLECLICKED)
        !          1156:                                break;
        !          1157:                        wParam = IDC_C;
        !          1158:                case IDC_B:
        !          1159:                case IDC_C:
        !          1160:                case IDC_X:
        !          1161:                case IDCANCEL:
        !          1162:                        if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
        !          1163:                                {
        !          1164:                                DestroyWindow(GetParent(hdlg));
        !          1165:                                return(fTrue);
        !          1166:                                }
        !          1167: 
        !          1168:                        iButtonChecked = 0;
        !          1169:                        for (i = 1; i <= 10; i++)
        !          1170:                                if (SendDlgItemMessage(hdlg, IDC_B0 + i, BM_GETCHECK, 0, 0L))
        !          1171:                                        {
        !          1172:                                        iButtonChecked = i;
        !          1173:                                        break;
        !          1174:                                        }
        !          1175: 
        !          1176:                        IntToAscii((int)iButtonChecked, (LPSTR)rgchNum);
        !          1177:                        if (!FSetSymbolValue("ButtonChecked", rgchNum))
        !          1178:                                {
        !          1179:                                DestroyWindow(GetParent(hdlg));
        !          1180:                                return(fTrue);
        !          1181:                                }
        !          1182: 
        !          1183:                        ReactivateSetupScript();
        !          1184:                        break;
        !          1185:                        }
        !          1186:                break;
        !          1187:                }
        !          1188: 
        !          1189:        return(fFalse);
        !          1190: }
        !          1191: 
        !          1192: 
        !          1193: 
        !          1194: /*
        !          1195: **     Purpose:
        !          1196: **             Get Name and Organization Dialog procedure for templates
        !          1197: **             with two Edit controls.
        !          1198: **             (Limits the input string length to cbNameMax characters.)
        !          1199: **
        !          1200: **     Controls Recognized:
        !          1201: **             Edit       - IDC_EDIT, IDC_EDIT2
        !          1202: **             Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
        !          1203: **
        !          1204: **     Initialization Symbols:
        !          1205: **             none.
        !          1206: **
        !          1207: **     Termination Symbols:
        !          1208: **             "NameOut" - text in the IDC_EDIT edit control upon termination.
        !          1209: **             "OrgOut"  - text in the IDC_EDIT2 edit control upon termination.
        !          1210: **             "DLGEVENT"    - one of the following, depending on event:
        !          1211: **                             event                value
        !          1212: **                             ----------           ----------
        !          1213: **                             IDC_B                "BACK"
        !          1214: **                             IDC_C                "CONTINUE"
        !          1215: **                             IDC_X                "EXIT"
        !          1216: **                             IDCANCEL             "CANCEL"
        !          1217: **
        !          1218: **     Note:
        !          1219: **             Pushbutton IDC_H will open the related Help dialog, if any.
        !          1220: **
        !          1221: *****************************************************************************/
        !          1222: BOOL FAR PASCAL FNameOrgDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !          1223: {
        !          1224:        static WORD wSelStart1 = 0;
        !          1225:        static WORD wSelEnd1   = 0;
        !          1226:        static WORD wSelStart2 = 0;
        !          1227:        static WORD wSelEnd2   = 0;
        !          1228:        char  rgchText[cbNameMax + 1];
        !          1229: 
        !          1230:        switch (wMsg)
        !          1231:                {
        !          1232:        case WM_INITDIALOG:
        !          1233:                SendDlgItemMessage(hdlg, IDC_EDIT, EM_LIMITTEXT, cbNameMax, 0L);
        !          1234:                SetDlgItemText(hdlg, IDC_EDIT, (LPSTR)"");
        !          1235: 
        !          1236:                SendDlgItemMessage(hdlg, IDC_EDIT2, EM_LIMITTEXT, cbNameMax, 0L);
        !          1237:                SetDlgItemText(hdlg, IDC_EDIT2, (LPSTR)"");
        !          1238: 
        !          1239:                wSelStart1 = wSelEnd1 = 0;
        !          1240:                wSelStart2 = wSelEnd2 = 0;
        !          1241:                return(fTrue);
        !          1242: 
        !          1243:        case STF_REINITDIALOG:
        !          1244:                SendDlgItemMessage(hdlg, IDC_EDIT, EM_SETSEL, 0, MAKELONG(256, 256));
        !          1245:                SetFocus(GetDlgItem(hdlg, IDC_EDIT));
        !          1246:                return(fTrue);
        !          1247: 
        !          1248:        case STF_ACTIVATEAPP:
        !          1249:                return(fTrue);
        !          1250: 
        !          1251:        case WM_COMMAND:
        !          1252:                switch(wParam)
        !          1253:                        {
        !          1254:                case IDC_EDIT:
        !          1255:                        if (HIWORD(lParam) == EN_SETFOCUS)
        !          1256:                                SendDlgItemMessage(hdlg, IDC_EDIT, EM_SETSEL, 0,
        !          1257:                                                MAKELONG(wSelStart1, wSelEnd1));
        !          1258:                        else if (HIWORD(lParam) == EN_KILLFOCUS)
        !          1259:                                {
        !          1260:                                LONG l = SendDlgItemMessage(hdlg, IDC_EDIT, EM_GETSEL, 0, 0L);
        !          1261: 
        !          1262:                                wSelStart1 = LOWORD(l);
        !          1263:                                wSelEnd1   = HIWORD(l);
        !          1264:                                }
        !          1265:                        break;
        !          1266: 
        !          1267:                case IDC_EDIT2:
        !          1268:                        if (HIWORD(lParam) == EN_SETFOCUS)
        !          1269:                                SendDlgItemMessage(hdlg, IDC_EDIT2, EM_SETSEL, 0,
        !          1270:                                                MAKELONG(wSelStart2, wSelEnd2));
        !          1271:                        else if (HIWORD(lParam) == EN_KILLFOCUS)
        !          1272:                                {
        !          1273:                                LONG l = SendDlgItemMessage(hdlg, IDC_EDIT2, EM_GETSEL, 0, 0L);
        !          1274: 
        !          1275:                                wSelStart2 = LOWORD(l);
        !          1276:                                wSelEnd2   = HIWORD(l);
        !          1277:                                }
        !          1278:                        break;
        !          1279: 
        !          1280:                case IDC_H:
        !          1281:                        HdlgShowHelp();
        !          1282:                        return(fTrue);
        !          1283: 
        !          1284:                case IDC_B:
        !          1285:                case IDC_C:
        !          1286:                case IDC_X:
        !          1287:                case IDCANCEL:
        !          1288:                        if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
        !          1289:                                {
        !          1290:                                DestroyWindow(GetParent(hdlg));
        !          1291:                                return(fTrue);
        !          1292:                                }
        !          1293: 
        !          1294:                        SendDlgItemMessage(hdlg, IDC_EDIT, (WORD)WM_GETTEXT,
        !          1295:                                        cbNameMax + 1, (LONG)((LPSTR)rgchText));
        !          1296:                        if (!FSetSymbolValue("NameOut", rgchText))
        !          1297:                                {
        !          1298:                                DestroyWindow(GetParent(hdlg));
        !          1299:                                return(fTrue);
        !          1300:                                }
        !          1301: 
        !          1302:                        SendDlgItemMessage(hdlg, IDC_EDIT2, (WORD)WM_GETTEXT,
        !          1303:                                        cbNameMax + 1, (LONG)((LPSTR)rgchText));
        !          1304:                        if (!FSetSymbolValue("OrgOut", rgchText))
        !          1305:                                {
        !          1306:                                DestroyWindow(GetParent(hdlg));
        !          1307:                                return(fTrue);
        !          1308:                                }
        !          1309: 
        !          1310:                        ReactivateSetupScript();
        !          1311:                        break;
        !          1312:                        }
        !          1313:                break;
        !          1314:                }
        !          1315: 
        !          1316:        return(fFalse);
        !          1317: }
        !          1318: 
        !          1319: 
        !          1320: 
        !          1321: /*
        !          1322: **     Purpose:
        !          1323: **             Confirm Info Dialog procedure for templates with one to
        !          1324: **             static text controls.
        !          1325: **
        !          1326: **     Controls Recognized:
        !          1327: **             Text       - IDC_TEXT1 to IDC_TEXT10 (sequential)
        !          1328: **             Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
        !          1329: **
        !          1330: **     Initialization Symbols:
        !          1331: **             "ConfirmTextIn" - list of up to ten string items to initialize
        !          1332: **                     static text items (IDC_TEXT1-10).
        !          1333: **
        !          1334: **     Termination Symbols:
        !          1335: **             "DLGEVENT" - one of the following, depending on event:
        !          1336: **                             event                value
        !          1337: **                             ----------           ----------
        !          1338: **                             IDC_B                "BACK"
        !          1339: **                             IDC_C                "CONTINUE"
        !          1340: **                             IDC_X                "EXIT"
        !          1341: **                             IDCANCEL             "CANCEL"
        !          1342: **
        !          1343: **     Note:
        !          1344: **             Pushbutton IDC_H will open the related Help dialog, if any.
        !          1345: **
        !          1346: *****************************************************************************/
        !          1347: BOOL FAR PASCAL FConfirmDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
        !          1348: {
        !          1349:        WORD  idc;
        !          1350:        WORD  cItems;
        !          1351:        WORD  i, cb;
        !          1352:        char  szSymBuf[cbSymBuf];
        !          1353: 
        !          1354:        switch (wMsg)
        !          1355:                {
        !          1356:        case WM_INITDIALOG:
        !          1357:                cItems = UsGetListLength("ConfirmTextIn");
        !          1358:                idc = IDC_TEXT1;
        !          1359:                for (i = 1; i <= cItems; ++i)
        !          1360:                        {
        !          1361:                        WORD wCheck = 0;
        !          1362: 
        !          1363:                        cb = CbGetListItem("ConfirmTextIn", i, szSymBuf, cbSymBuf);
        !          1364:                        Assert(cb < cbSymBuf);
        !          1365:                        SetDlgItemText(hdlg, idc++, szSymBuf);
        !          1366:                        if (i >= 4
        !          1367:                                        && i <= 6)
        !          1368:                                {
        !          1369:                                if (*szSymBuf == '\0')
        !          1370:                                        ShowWindow(GetDlgItem(hdlg, IDC_TEXT4+i), SW_HIDE);
        !          1371:                                else
        !          1372:                                        ShowWindow(GetDlgItem(hdlg, IDC_TEXT4+i), SW_SHOWNOACTIVATE);
        !          1373:                                }
        !          1374:                        }
        !          1375:                return(fTrue);
        !          1376: 
        !          1377:        case STF_REINITDIALOG:
        !          1378:        case STF_ACTIVATEAPP:
        !          1379:                return(fTrue);
        !          1380: 
        !          1381:        case WM_COMMAND:
        !          1382:                switch (wParam)
        !          1383:                        {
        !          1384:                case IDC_H:
        !          1385:                        HdlgShowHelp();
        !          1386:                        return(fTrue);
        !          1387: 
        !          1388:                case IDC_B:
        !          1389:                case IDC_C:
        !          1390:                case IDC_X:
        !          1391:                case IDCANCEL:
        !          1392:                        if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
        !          1393:                                {
        !          1394:                                DestroyWindow(GetParent(hdlg));
        !          1395:                                return(fTrue);
        !          1396:                                }
        !          1397:                        ReactivateSetupScript();
        !          1398:                        break;
        !          1399:                        }
        !          1400:                break;
        !          1401:                }
        !          1402: 
        !          1403:        return(fFalse);
        !          1404: }
        !          1405: 
        !          1406: 
        !          1407: 
        !          1408: /*
        !          1409: **     Purpose:
        !          1410: **             Initialization routine for DLL.
        !          1411: **     Arguments:
        !          1412: **             hInst:       handle to instance of App that required this DLL.
        !          1413: **             wDataSeg:    number of words in DLL's data segment.
        !          1414: **             wHeapSize:   number of bytes in DLL's heap.
        !          1415: **             lpszCmdLine: command line for App that required this DLL.
        !          1416: **     Returns:
        !          1417: **             1 always
        !          1418: *****************************************************************************/
        !          1419: int FAR PASCAL LibMain(HANDLE hInst, WORD wDataSeg, WORD wHeapSize,
        !          1420:                LPSTR lpszCmdLine)
        !          1421: {
        !          1422:        if (wHeapSize > 0)
        !          1423:                UnlockData(0);
        !          1424: 
        !          1425:        return(1);
        !          1426: }
        !          1427: 
        !          1428: 
        !          1429: 
        !          1430: /*
        !          1431: **     Purpose:
        !          1432: **             Windows Exit Procedure.
        !          1433: **     Arguments:
        !          1434: **             nParam: standard WEP param (ignored).
        !          1435: **     Returns:
        !          1436: **             1 always.
        !          1437: *****************************************************************************/
        !          1438: int FAR PASCAL WEP (int nParam)
        !          1439: {
        !          1440:        return(1);
        !          1441: }
        !          1442: 
        !          1443: 
        !          1444: 
        !          1445: /*
        !          1446: **     Purpose:
        !          1447: **             Finds the last character in a string.
        !          1448: **     Arguments:
        !          1449: **             sz: non-NULL zero terminated string to search.
        !          1450: **     Returns:
        !          1451: **             NULL for an empty string.
        !          1452: **             non-Null string pointer to the last valid character in sz.
        !          1453: *****************************************************************************/
        !          1454: LPSTR FAR PASCAL SzLastChar(LPSTR sz)
        !          1455: {
        !          1456:        LPSTR szCur  = (LPSTR)NULL;
        !          1457:        LPSTR szNext = sz;
        !          1458: 
        !          1459:        while (*szNext != '\0')
        !          1460:                szNext = AnsiNext((szCur = szNext));
        !          1461: 
        !          1462:        return(szCur);
        !          1463: }
        !          1464: 
        !          1465: 
        !          1466: 
        !          1467: /*
        !          1468: **     Purpose:
        !          1469: **             Gets the string values for the following WM_COMMAND events:
        !          1470: **                     IDC_B, IDC_C, IDC_X, and IDCANCEL.
        !          1471: **     Arguments:
        !          1472: **             wParam: event parameter value
        !          1473: **     Returns:
        !          1474: **             Pointer to string value constant, NULL if unknown event.
        !          1475: *****************************************************************************/
        !          1476: LPSTR FAR PASCAL SzDlgEvent(WORD wParam)
        !          1477: {
        !          1478:        LPSTR szEvent;
        !          1479: 
        !          1480:        switch(wParam)
        !          1481:                {
        !          1482:        case IDC_B:
        !          1483:                szEvent = "BACK";
        !          1484:                break;
        !          1485:        case IDC_C:
        !          1486:                szEvent = "CONTINUE";
        !          1487:                break;
        !          1488:        case IDC_X:
        !          1489:                szEvent = "EXIT";
        !          1490:                break;
        !          1491:        case IDCANCEL:
        !          1492:                szEvent = "CANCEL";
        !          1493:                break;
        !          1494:        default:
        !          1495:                szEvent = NULL;
        !          1496:                break;
        !          1497:                }
        !          1498: 
        !          1499:        return(szEvent);
        !          1500: }
        !          1501: 
        !          1502: 
        !          1503: 
        !          1504: /*
        !          1505: **     Purpose:
        !          1506: **             Converts an ASCII string representing a positive value
        !          1507: **             into an integer.
        !          1508: **     Arguments:
        !          1509: **             sz: non-NULL zero terminated string to convert.
        !          1510: **     Returns:
        !          1511: **             Integer represented by the string.
        !          1512: *****************************************************************************/
        !          1513: int FAR PASCAL AsciiToInt(LPSTR sz)
        !          1514: {
        !          1515:        int i = 0;
        !          1516: 
        !          1517:        while (*sz == ' ' || *sz == '\t')
        !          1518:                sz++;
        !          1519: 
        !          1520:        while (isdigit(*sz))
        !          1521:                i = (i * 10) + *sz++ - '0';
        !          1522: 
        !          1523:        return(i);
        !          1524: }
        !          1525: 
        !          1526: 
        !          1527: 
        !          1528: /*
        !          1529: **     Purpose:
        !          1530: **             Converts an positive integer (< 100) into a string
        !          1531: **             representing its value.
        !          1532: **     Arguments:
        !          1533: **             i:  integer to convert (positive and < 100).
        !          1534: **             sz: buffer to hold converted string (at least 3 bytes).
        !          1535: **     Returns:
        !          1536: **             sz.
        !          1537: *****************************************************************************/
        !          1538: LPSTR FAR PASCAL IntToAscii(int i, LPSTR sz)
        !          1539: {
        !          1540:        LPSTR szSav = sz;
        !          1541: 
        !          1542:        if (i >= 100
        !          1543:                        || i < 0)
        !          1544:                Assert(fFalse);
        !          1545: 
        !          1546:        if (i >= 10)
        !          1547:                {
        !          1548:                *sz++ = (char)('0' + (i / 10));
        !          1549:                i %= 10;
        !          1550:                }
        !          1551:        *sz++ = (char)('0' + i);
        !          1552:        *sz = '\0';
        !          1553: 
        !          1554:        return(szSav);
        !          1555: }
        !          1556: 
        !          1557: 
        !          1558: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.