|
|
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: ** Display Dialog procedure for templates to display symbol
366: ** message with editting.
367: ** (Limits the input string length to cbFullPathMax characters.)
368: **
369: ** Controls Recognized:
370: ** Edit - IDC_EDIT
371: ** Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
372: **
373: ** Initialization Symbols:
374: ** "EditTextIn" - initial text for IDC_EDIT edit control.
375: ** "EditFocus" - position of intial focus for text string:
376: ** "END" (default), "ALL", or "START"
377: **
378: ** Termination Symbols:
379: ** "EditTextOut" - text in the IDC_EDIT edit control upon termination.
380: ** "DLGEVENT" - one of the following, depending on event:
381: ** event value
382: ** ---------- ----------
383: ** IDC_B "BACK"
384: ** IDC_C "CONTINUE"
385: ** IDC_X "EXIT"
386: ** IDCANCEL "CANCEL"
387: ** STF_ACTIVATEAPP "REACTIVATE"
388: **
389: ** Note:
390: ** Pushbutton IDC_H will open the related Help dialog, if any.
391: **
392: *****************************************************************************/
393: BOOL FAR PASCAL FDispDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
394: {
395: static WORD wSelStart = 0;
396: static WORD wSelEnd = 0;
397: char rgchText[cbFullPathMax + 1];
398: WORD cbLen;
399: WORD cb;
400: char szSymBuf[cbFullPathMax + 1];
401:
402: switch (wMsg)
403: {
404: case STF_ACTIVATEAPP:
405: if (!FSetSymbolValue("DLGEVENT", "REACTIVATE"))
406: {
407: DestroyWindow(GetParent(hdlg));
408: return(fTrue);
409: }
410: ReactivateSetupScript();
411: return(fTrue);
412:
413: case WM_INITDIALOG:
414: cb = CbGetSymbolValue("EditTextIn", szSymBuf, cbFullPathMax + 1);
415: Assert(cb < cbFullPathMax + 1);
416: SendDlgItemMessage(hdlg, IDC_TEXT1, EM_LIMITTEXT, cbFullPathMax, 0L);
417: SetDlgItemText(hdlg, IDC_TEXT1, (LPSTR)szSymBuf);
418:
419: cbLen = lstrlen(szSymBuf);
420: cb = CbGetSymbolValue("EditFocus", szSymBuf, cbFullPathMax + 1);
421: Assert(cb < cbFullPathMax + 1);
422:
423: if (lstrcmp(szSymBuf, "ALL") == 0)
424: {
425: wSelStart = 0;
426: wSelEnd = INT_MAX;
427: }
428: else if (lstrcmp(szSymBuf, "START") == 0)
429: {
430: wSelStart = 0;
431: wSelEnd = 0;
432: }
433: else /* default == END */
434: {
435: wSelStart = (WORD)cbLen;
436: wSelEnd = (WORD)cbLen;
437: }
438: return(fTrue);
439:
440: case STF_REINITDIALOG:
441: SendDlgItemMessage(hdlg, IDC_TEXT1, EM_SETSEL, 0, MAKELONG(256, 256));
442: SetFocus(GetDlgItem(hdlg, IDC_TEXT1));
443: return(fTrue);
444:
445: case WM_COMMAND:
446: switch(wParam)
447: {
448: case IDC_H:
449: HdlgShowHelp();
450: return(fTrue);
451:
452: case IDC_B:
453: case IDC_C:
454: case IDC_X:
455: case IDCANCEL:
456: if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
457: {
458: DestroyWindow(GetParent(hdlg));
459: return(fTrue);
460: }
461: SendDlgItemMessage(hdlg, IDC_TEXT1, (WORD)WM_GETTEXT,
462: cbFullPathMax + 1, (LONG)((LPSTR)rgchText));
463: if (!FSetSymbolValue("EditTextOut", rgchText))
464: {
465: DestroyWindow(GetParent(hdlg));
466: return(fTrue);
467: }
468: ReactivateSetupScript();
469: break;
470: }
471: break;
472: }
473:
474: return(fFalse);
475: }
476:
477: /*
478: ** Purpose:
479: ** Edit Dialog procedure for templates with one Edit control.
480: ** (Limits the input string length to cbFullPathMax characters.)
481: **
482: ** Controls Recognized:
483: ** Edit - IDC_EDIT
484: ** Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
485: **
486: ** Initialization Symbols:
487: ** "EditTextIn" - initial text for IDC_EDIT edit control.
488: ** "EditFocus" - position of intial focus for text string:
489: ** "END" (default), "ALL", or "START"
490: **
491: ** Termination Symbols:
492: ** "EditTextOut" - text in the IDC_EDIT edit control upon termination.
493: ** "DLGEVENT" - one of the following, depending on event:
494: ** event value
495: ** ---------- ----------
496: ** IDC_B "BACK"
497: ** IDC_C "CONTINUE"
498: ** IDC_X "EXIT"
499: ** IDCANCEL "CANCEL"
500: ** STF_ACTIVATEAPP "REACTIVATE"
501: **
502: ** Note:
503: ** Pushbutton IDC_H will open the related Help dialog, if any.
504: **
505: *****************************************************************************/
506: BOOL FAR PASCAL FEditDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
507: {
508: static WORD wSelStart = 0;
509: static WORD wSelEnd = 0;
510: char rgchText[cbFullPathMax + 1];
511: WORD cbLen;
512: WORD cb;
513: char szSymBuf[cbFullPathMax + 1];
514:
515: switch (wMsg)
516: {
517: case STF_ACTIVATEAPP:
518: if (!FSetSymbolValue("DLGEVENT", "REACTIVATE"))
519: {
520: DestroyWindow(GetParent(hdlg));
521: return(fTrue);
522: }
523: ReactivateSetupScript();
524: return(fTrue);
525:
526: case WM_INITDIALOG:
527: cb = CbGetSymbolValue("EditTextIn", szSymBuf, cbFullPathMax + 1);
528: Assert(cb < cbFullPathMax + 1);
529: SendDlgItemMessage(hdlg, IDC_EDIT, EM_LIMITTEXT, cbFullPathMax, 0L);
530: SetDlgItemText(hdlg, IDC_EDIT, (LPSTR)szSymBuf);
531:
532: cbLen = lstrlen(szSymBuf);
533: cb = CbGetSymbolValue("EditFocus", szSymBuf, cbFullPathMax + 1);
534: Assert(cb < cbFullPathMax + 1);
535:
536: if (lstrcmp(szSymBuf, "ALL") == 0)
537: {
538: wSelStart = 0;
539: wSelEnd = INT_MAX;
540: }
541: else if (lstrcmp(szSymBuf, "START") == 0)
542: {
543: wSelStart = 0;
544: wSelEnd = 0;
545: }
546: else /* default == END */
547: {
548: wSelStart = (WORD)cbLen;
549: wSelEnd = (WORD)cbLen;
550: }
551: return(fTrue);
552:
553: case STF_REINITDIALOG:
554: SendDlgItemMessage(hdlg, IDC_EDIT, EM_SETSEL, 0, MAKELONG(256, 256));
555: SetFocus(GetDlgItem(hdlg, IDC_EDIT));
556: return(fTrue);
557:
558: case WM_COMMAND:
559: switch(wParam)
560: {
561: case IDC_EDIT:
562: if (HIWORD(lParam) == EN_SETFOCUS)
563: SendDlgItemMessage(hdlg, IDC_EDIT, EM_SETSEL, 0,
564: MAKELONG(wSelStart, wSelEnd));
565: else if (HIWORD(lParam) == EN_KILLFOCUS)
566: {
567: LONG l = SendDlgItemMessage(hdlg, IDC_EDIT, EM_GETSEL, 0, 0L);
568:
569: wSelStart = LOWORD(l);
570: wSelEnd = HIWORD(l);
571: }
572: break;
573: case IDC_H:
574: HdlgShowHelp();
575: return(fTrue);
576:
577: case IDC_B:
578: case IDC_C:
579: case IDC_X:
580: case IDCANCEL:
581: if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
582: {
583: DestroyWindow(GetParent(hdlg));
584: return(fTrue);
585: }
586: SendDlgItemMessage(hdlg, IDC_EDIT, (WORD)WM_GETTEXT,
587: cbFullPathMax + 1, (LONG)((LPSTR)rgchText));
588: if (!FSetSymbolValue("EditTextOut", rgchText))
589: {
590: DestroyWindow(GetParent(hdlg));
591: return(fTrue);
592: }
593: ReactivateSetupScript();
594: break;
595: }
596: break;
597: }
598:
599: return(fFalse);
600: }
601:
602:
603:
604: /*
605: ** Purpose:
606: ** Help Dialog procedure.
607: **
608: ** Controls Recognized:
609: ** Pushbutton - IDC_X.
610: **
611: ** Initialization Symbols:
612: ** none.
613: **
614: ** Termination Symbols:
615: ** none. (Handles IDC_X and IDCANCEL events by calling FCloseHelp.)
616: **
617: ** Note:
618: ** This dialog proc is for Help dialogs ONLY (szHelpProc$ parameter
619: ** of UIStartDlg) and CANNOT be used as the szDlgProc$ parameter
620: ** of the UIStartDlg MSSetup script function.
621: **
622: *****************************************************************************/
623: BOOL FAR PASCAL FHelpDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
624: {
625: switch (wMsg)
626: {
627: case WM_INITDIALOG:
628: return(fTrue);
629:
630: case STF_REINITDIALOG:
631: return(fTrue);
632:
633: case STF_ACTIVATEAPP:
634: /* Help dlg should not be on the dlg stack
635: ** and should never get this message.
636: */
637: Assert(fFalse);
638: return(fTrue);
639:
640: case WM_COMMAND:
641: if (wParam != IDC_X
642: && wParam != IDCANCEL)
643: break;
644: FCloseHelp();
645: return(fTrue);
646:
647: }
648: return(fFalse);
649: }
650:
651:
652:
653: /*
654: ** Purpose:
655: ** Information Dialog procedure.
656: **
657: ** Controls Recognized:
658: ** Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
659: **
660: ** Initialization Symbols:
661: ** none.
662: **
663: ** Termination Symbols:
664: ** "DLGEVENT" - one of the following, according to control event:
665: ** event value
666: ** ------- -------
667: ** IDC_B "BACK"
668: ** IDC_C "CONTINUE"
669: ** IDC_X "EXIT"
670: ** IDCANCEL "CANCEL"
671: **
672: ** Note:
673: ** Pushbutton IDC_H will open the related Help dialog, if any.
674: **
675: *****************************************************************************/
676: BOOL FAR PASCAL FInfoDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
677: {
678: switch (wMsg)
679: {
680: case WM_INITDIALOG:
681: return(fTrue);
682:
683: case STF_REINITDIALOG:
684: case STF_ACTIVATEAPP:
685: return(fTrue);
686:
687: case WM_COMMAND:
688: switch (wParam)
689: {
690: case IDC_H:
691: HdlgShowHelp();
692: return(fTrue);
693:
694: case IDC_B:
695: case IDC_C:
696: case IDC_X:
697: case IDCANCEL:
698: if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
699: {
700: DestroyWindow(GetParent(hdlg));
701: return(fTrue);
702: }
703: ReactivateSetupScript();
704: break;
705: }
706: break;
707: }
708:
709: return(fFalse);
710: }
711:
712:
713:
714: /*
715: ** Purpose:
716: ** Information Dialog procedure, without "Exit" button.
717: **
718: ** Controls Recognized:
719: ** Pushbutton - IDC_B, IDC_C, IDC_H
720: **
721: ** Initialization Symbols:
722: ** none.
723: **
724: ** Termination Symbols:
725: ** "DLGEVENT" - one of the following, depending on event:
726: ** event value
727: ** ---------- ----------
728: ** IDC_B "BACK"
729: ** IDC_C "CONTINUE"
730: ** IDCANCEL "CANCEL"
731: ** STF_ACTIVATEAPP "REACTIVATE"
732: **
733: ** Note:
734: ** Pushbutton IDC_H will open the related Help dialog, if any.
735: **
736: *****************************************************************************/
737: BOOL FAR PASCAL FInfo0DlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
738: {
739: switch (wMsg)
740: {
741: case WM_INITDIALOG:
742: return(fTrue);
743:
744: case STF_REINITDIALOG:
745: return(fTrue);
746:
747: case STF_ACTIVATEAPP:
748: if (!FSetSymbolValue("DLGEVENT", "REACTIVATE"))
749: {
750: DestroyWindow(GetParent(hdlg));
751: return(fTrue);
752: }
753: ReactivateSetupScript();
754: return(fTrue);
755:
756: case WM_COMMAND:
757: switch (wParam)
758: {
759: case IDC_H:
760: HdlgShowHelp();
761: return(fTrue);
762:
763: case IDC_B:
764: case IDC_C:
765: case IDCANCEL:
766: if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
767: {
768: DestroyWindow(GetParent(hdlg));
769: return(fTrue);
770: }
771: ReactivateSetupScript();
772: break;
773: }
774: break;
775: }
776:
777: return(fFalse);
778: }
779:
780:
781:
782: /*
783: ** Purpose:
784: ** Single Choice Listbox Dialog procedure for templates with exactly one
785: ** listbox control.
786: **
787: ** Controls Recognized:
788: ** Listbox - IDC_LIST1
789: ** Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
790: **
791: ** Initialization Symbols:
792: ** "ListItemsIn" - list of strings to put in the listbox.
793: ** "ListItemsOut" - simple string (not a list) representing an
794: ** initial selection in "ListItemsIn".
795: **
796: ** Termination Symbols:
797: ** "ListItemsOut" - selected list item string.
798: ** "DLGEVENT" - one of the following, according to control event:
799: ** event value
800: ** ------- -------
801: ** IDC_B "BACK"
802: ** IDC_C "CONTINUE"
803: ** IDC_X "EXIT"
804: ** IDCANCEL "CANCEL"
805: **
806: ** Note:
807: ** Pushbutton IDC_H will open the related Help dialog, if any.
808: **
809: *****************************************************************************/
810: BOOL FAR PASCAL FListDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
811: {
812: char szListIn[cbSymBuf];
813: char szListOut[cbSymBuf];
814: WORD iItem;
815: WORD cb, i;
816: WORD cItems;
817:
818: switch (wMsg)
819: {
820: case WM_INITDIALOG:
821: cItems = UsGetListLength("ListItemsIn");
822: for (i = 1; i <= cItems; ++i)
823: {
824: cb = CbGetListItem("ListItemsIn", i, szListIn, cbSymBuf);
825: Assert(cb < cbSymBuf);
826: SendDlgItemMessage(hdlg, IDC_LIST1, LB_ADDSTRING, 0,
827: (LONG)(LPSTR)szListIn);
828: }
829:
830: cb = CbGetSymbolValue("ListItemsOut", szListOut, cbSymBuf);
831: Assert(cb < cbSymBuf);
832: if (cb == 0)
833: SendDlgItemMessage(hdlg, IDC_LIST1, LB_SETCURSEL, (WORD)-1, 0L);
834: else
835: {
836: for (i = 1, iItem = 0; i <= cItems; ++i, ++iItem)
837: {
838: cb = CbGetListItem("ListItemsIn", i, szListIn, cbSymBuf);
839: Assert(cb < cbSymBuf);
840: if (lstrcmp(szListOut, szListIn) == 0)
841: {
842: SendDlgItemMessage(hdlg,IDC_LIST1,LB_SETCURSEL,iItem,0L);
843: break;
844: }
845: }
846: }
847:
848: /* Note: Depends on number of lines in list box.
849: */
850: if (iItem < 4)
851: iItem = 0;
852: SendDlgItemMessage(hdlg, IDC_LIST1, LB_SETTOPINDEX, iItem, 0L);
853:
854: return(fTrue);
855:
856: case STF_REINITDIALOG:
857: case STF_ACTIVATEAPP:
858: return(fTrue);
859:
860: case WM_COMMAND:
861: switch(wParam)
862: {
863: case IDC_H:
864: HdlgShowHelp();
865: return(fTrue);
866:
867: case IDC_LIST1:
868: if (HIWORD(lParam) != LBN_DBLCLK)
869: break;
870: wParam = IDC_C;
871: case IDC_B:
872: case IDC_C:
873: case IDC_X:
874: case IDCANCEL:
875: if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
876: {
877: DestroyWindow(GetParent(hdlg));
878: return(fTrue);
879: }
880:
881: if ((iItem = (WORD)SendDlgItemMessage(hdlg, IDC_LIST1, LB_GETCURSEL,
882: 0, 0L)) == LB_ERR
883: || (cb = (WORD)SendDlgItemMessage(hdlg, IDC_LIST1,
884: LB_GETTEXTLEN, iItem, 0L)) == LB_ERR)
885: *szListOut = '\0';
886: else
887: {
888: Assert(cb <= cbSymBuf);
889: SendDlgItemMessage(hdlg, IDC_LIST1, LB_GETTEXT, iItem,
890: (LONG)(LPSTR)szListOut);
891: }
892: if (!FSetSymbolValue("ListItemsOut", szListOut))
893: {
894: DestroyWindow(GetParent(hdlg));
895: return(fTrue);
896: }
897:
898: ReactivateSetupScript();
899: break;
900: }
901: break;
902:
903: }
904:
905: return(fFalse);
906: }
907:
908:
909:
910: /*
911: ** Purpose:
912: ** Modeless Dialog procedure.
913: **
914: ** Controls Recognized:
915: ** none.
916: **
917: ** Initialization Symbols:
918: ** none.
919: **
920: ** Termination Symbols:
921: ** none.
922: **
923: ** Note:
924: ** This dialog procedure is REQUIRED with use of any Billboard
925: ** MSSetup script functions.
926: **
927: *****************************************************************************/
928: BOOL FAR PASCAL FModelessDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
929: {
930: switch (wMsg)
931: {
932: case WM_INITDIALOG:
933: ReactivateSetupScript();
934: return(fTrue);
935:
936: case STF_REINITDIALOG:
937: case STF_ACTIVATEAPP:
938: return(fTrue);
939:
940: case WM_CLOSE:
941: case WM_COMMAND:
942: Assert(fFalse);
943: break;
944: }
945:
946: return(fFalse);
947: }
948:
949:
950:
951: /*
952: ** Purpose:
953: ** Multiple Choice Listbox Dialog procedure for templates with
954: ** exactly one listbox control.
955: **
956: ** Controls Recognized:
957: ** Listbox - IDC_LIST1
958: ** Pushbutton - IDC_B, IDC_C, IDC_H, IDC_L, IDC_S, IDC_X
959: **
960: ** Initialization Symbols:
961: ** "ListItemsIn" - list of strings to put in the listbox.
962: ** "ListItemsOut" - list of strings representing initial
963: ** selections in "ListItemsIn".
964: **
965: ** Termination Symbols:
966: ** "ListItemsOut" - list of items selected (if any).
967: ** "DLGEVENT" - one of the following, according to control event:
968: ** event value
969: ** ------- -------
970: ** IDC_B "BACK"
971: ** IDC_C "CONTINUE"
972: ** IDC_X "EXIT"
973: ** IDCANCEL "CANCEL"
974: **
975: ** Note:
976: ** Pushbutton IDC_H will open the related Help dialog, if any.
977: ** Pushbuttons IDC_L and IDC_S are for "clear all" and "select all"
978: ** respectively.
979: **
980: *****************************************************************************/
981: BOOL FAR PASCAL FMultiDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
982: {
983: WORD i, j, nCount;
984: char szListIn[cbSymBuf];
985: char szListOut[cbSymBuf];
986: WORD iItem, iItemTop;
987: WORD cb;
988: WORD cItemsIn, cItemsOut;
989:
990: switch (wMsg)
991: {
992: case WM_INITDIALOG:
993: cItemsIn = UsGetListLength("ListItemsIn");
994: nCount = 0;
995: for (i = 1; i <= cItemsIn; ++i)
996: {
997: cb = CbGetListItem("ListItemsIn", i, szListIn, cbSymBuf);
998: Assert(cb < cbSymBuf);
999: SendDlgItemMessage(hdlg, IDC_LIST1, LB_ADDSTRING, 0,
1000: (LONG)(LPSTR)szListIn);
1001: nCount++;
1002: }
1003: Assert(nCount == (WORD)SendDlgItemMessage(hdlg, IDC_LIST1, LB_GETCOUNT,
1004: 0, 0L));
1005:
1006: cItemsOut = UsGetListLength("ListItemsOut");
1007: for (i = 1, iItemTop = 0; i <= cItemsOut; ++i, ++iItemTop)
1008: {
1009: cb = CbGetListItem("ListItemsOut", i, szListOut, cbSymBuf);
1010: Assert(cb < cbSymBuf);
1011: for (j = 1, iItem = 0; j <= cItemsIn; ++j, ++iItem)
1012: {
1013: cb = CbGetListItem("ListItemsIn", j, szListIn, cbSymBuf);
1014: Assert(cb < cbSymBuf);
1015: if (lstrcmp(szListOut, szListIn) == 0)
1016: {
1017: SendDlgItemMessage(hdlg, IDC_LIST1, LB_SETSEL, 1,
1018: MAKELONG(iItem, 0));
1019: if (iItemTop == 0
1020: || (WORD)iItem < iItemTop)
1021: iItemTop = (WORD)iItem;
1022: break;
1023: }
1024: }
1025: }
1026:
1027: /* Note: Depends on number of lines in list box.
1028: */
1029: if (iItemTop < 4)
1030: iItemTop = 0;
1031: SendDlgItemMessage(hdlg, IDC_LIST1, LB_SETTOPINDEX, iItemTop, 0L);
1032:
1033: return(fTrue);
1034:
1035: case STF_REINITDIALOG:
1036: case STF_ACTIVATEAPP:
1037: return(fTrue);
1038:
1039: case WM_COMMAND:
1040: switch(wParam)
1041: {
1042: case IDC_S:
1043: case IDC_L:
1044: SendDlgItemMessage(hdlg, IDC_LIST1, LB_SETSEL, (wParam == IDC_S),
1045: -1L);
1046: break;
1047:
1048: case IDC_H:
1049: HdlgShowHelp();
1050: return(fTrue);
1051:
1052: case IDC_B:
1053: case IDC_C:
1054: case IDC_X:
1055: case IDCANCEL:
1056: if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
1057: {
1058: DestroyWindow(GetParent(hdlg));
1059: return(fTrue);
1060: }
1061:
1062: /* Note: Could be faster to use LB_GETSELITEMS here.
1063: */
1064: nCount = (WORD)SendDlgItemMessage(hdlg, IDC_LIST1, LB_GETCOUNT, 0,
1065: 0L);
1066:
1067: FRemoveSymbol("ListItemsOut");
1068: for (i = 0; i < nCount; i++)
1069: {
1070: if (SendDlgItemMessage(hdlg, IDC_LIST1, LB_GETSEL, (WORD)i, 0L))
1071: {
1072: SendDlgItemMessage(hdlg, IDC_LIST1, LB_GETTEXT, (WORD)i,
1073: (LONG)(LPSTR)szListOut);
1074: if (!FAddListItem("ListItemsOut", szListOut))
1075: {
1076: DestroyWindow(GetParent(hdlg));
1077: return(fTrue);
1078: }
1079: }
1080: }
1081:
1082: ReactivateSetupScript();
1083: break;
1084: }
1085: break;
1086: }
1087:
1088: return(fFalse);
1089: }
1090:
1091:
1092:
1093: /*
1094: ** Purpose:
1095: ** Quit Dialog procedure.
1096: **
1097: ** Controls Recognized:
1098: ** Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
1099: **
1100: ** Initialization Symbols:
1101: ** none.
1102: **
1103: ** Termination Symbols:
1104: ** "DLGEVENT" - one of the following, depending on event:
1105: ** event value
1106: ** ---------- ----------
1107: ** IDC_B "BACK"
1108: ** IDC_C "CONTINUE"
1109: ** IDC_X "EXIT"
1110: ** IDCANCEL "CANCEL"
1111: ** STF_ACTIVATEAPP "REACTIVATE"
1112: **
1113: ** Note:
1114: ** Pushbutton IDC_H will open the related Help dialog, if any.
1115: **
1116: *****************************************************************************/
1117: BOOL FAR PASCAL FQuitDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
1118: {
1119: switch (wMsg)
1120: {
1121: case WM_INITDIALOG:
1122: return(fTrue);
1123:
1124: case STF_REINITDIALOG:
1125: return(fTrue);
1126:
1127: case STF_ACTIVATEAPP:
1128: if (!FSetSymbolValue("DLGEVENT", "REACTIVATE"))
1129: {
1130: DestroyWindow(GetParent(hdlg));
1131: return(fTrue);
1132: }
1133: ReactivateSetupScript();
1134: return(fTrue);
1135:
1136: case WM_COMMAND:
1137: switch(wParam)
1138: {
1139: case IDC_H:
1140: HdlgShowHelp();
1141: return(fTrue);
1142:
1143: case IDC_B:
1144: case IDC_C:
1145: case IDC_X:
1146: case IDCANCEL:
1147: if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
1148: {
1149: DestroyWindow(GetParent(hdlg));
1150: return(fTrue);
1151: }
1152:
1153: ReactivateSetupScript();
1154: break;
1155: }
1156: break;
1157: }
1158: return(fFalse);
1159: }
1160:
1161:
1162:
1163: /*
1164: ** Purpose:
1165: ** Radio Button Group Dialog procedure for templates with one group
1166: ** of one to ten radio button controls.
1167: **
1168: ** Controls Recognized:
1169: ** Radio - IDC_B1 to IDC_B10 (sequential)
1170: ** Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
1171: **
1172: ** Initialization Symbols:
1173: ** "RadioDefault" - index (one-based) of radio button to be
1174: ** initialized as selected (default is "1").
1175: ** "OptionsGreyed" - list of (one-based) indexes of radio buttons
1176: ** to be initialized as disabled. Indexes not in the list will
1177: ** be left enabled.
1178: **
1179: ** Termination Symbols:
1180: ** "ButtonChecked" - index of currently selected radio button.
1181: ** "DLGEVENT" - one of the following, depending on event:
1182: ** event value
1183: ** ---------- ----------
1184: ** IDC_B "BACK"
1185: ** IDC_C "CONTINUE"
1186: ** IDC_X "EXIT"
1187: ** IDCANCEL "CANCEL"
1188: ** STF_ACTIVATEAPP "REACTIVATE"
1189: **
1190: ** Note:
1191: ** Pushbutton IDC_H will open the related Help dialog, if any.
1192: **
1193: *****************************************************************************/
1194: BOOL FAR PASCAL FRadioDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
1195: {
1196: char rgchNum[10];
1197: int iButtonChecked;
1198: char szSymBuf[cbSymBuf];
1199: WORD i, cb, cItems, idc;
1200:
1201: switch (wMsg)
1202: {
1203: case STF_ACTIVATEAPP:
1204: if (!FSetSymbolValue("DLGEVENT", "REACTIVATE"))
1205: {
1206: DestroyWindow(GetParent(hdlg));
1207: return(fTrue);
1208: }
1209: ReactivateSetupScript();
1210: return(fTrue);
1211:
1212: case WM_INITDIALOG:
1213: cb = CbGetSymbolValue("RadioDefault", szSymBuf, cbSymBuf);
1214: Assert(cb < cbSymBuf);
1215: if (*szSymBuf != '\0')
1216: {
1217: iButtonChecked = AsciiToInt((LPSTR)szSymBuf);
1218: if (iButtonChecked < 1)
1219: iButtonChecked = 0;
1220: if (iButtonChecked > 10)
1221: iButtonChecked = 10;
1222: }
1223: else
1224: iButtonChecked = 1;
1225:
1226: if (iButtonChecked != 0)
1227: SendDlgItemMessage(hdlg, IDC_B0 + iButtonChecked, BM_SETCHECK,1,0L);
1228:
1229: cItems = UsGetListLength("OptionsGreyed");
1230: idc = IDC_B1;
1231: for (i = 1; i <= cItems; ++i)
1232: {
1233: int iOpt;
1234:
1235: cb = CbGetListItem("OptionsGreyed", i, szSymBuf, cbSymBuf);
1236: Assert(cb < cbSymBuf);
1237: iOpt = AsciiToInt((LPSTR)szSymBuf);
1238: if (iOpt > 0
1239: && iOpt <= 10
1240: && iOpt != iButtonChecked)
1241: EnableWindow(GetDlgItem(hdlg, IDC_B0 + iOpt), 0);
1242: else if (*szSymBuf != '\0')
1243: Assert(fFalse);
1244: }
1245: return(fTrue);
1246:
1247: case STF_REINITDIALOG:
1248: return(fTrue);
1249:
1250: case WM_COMMAND:
1251: switch (wParam)
1252: {
1253: case IDC_H:
1254: HdlgShowHelp();
1255: return(fTrue);
1256:
1257: case IDC_B1:
1258: case IDC_B2:
1259: case IDC_B3:
1260: case IDC_B4:
1261: case IDC_B5:
1262: case IDC_B6:
1263: case IDC_B7:
1264: case IDC_B8:
1265: case IDC_B9:
1266: case IDC_B10:
1267: CheckRadioButton(hdlg, IDC_B1, IDC_B10, wParam);
1268: if (HIWORD(lParam) != BN_DOUBLECLICKED)
1269: break;
1270: wParam = IDC_C;
1271: case IDC_B:
1272: case IDC_C:
1273: case IDC_X:
1274: case IDCANCEL:
1275: if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
1276: {
1277: DestroyWindow(GetParent(hdlg));
1278: return(fTrue);
1279: }
1280:
1281: iButtonChecked = 0;
1282: for (i = 1; i <= 10; i++)
1283: if (SendDlgItemMessage(hdlg, IDC_B0 + i, BM_GETCHECK, 0, 0L))
1284: {
1285: iButtonChecked = i;
1286: break;
1287: }
1288:
1289: IntToAscii((int)iButtonChecked, (LPSTR)rgchNum);
1290: if (!FSetSymbolValue("ButtonChecked", rgchNum))
1291: {
1292: DestroyWindow(GetParent(hdlg));
1293: return(fTrue);
1294: }
1295:
1296: ReactivateSetupScript();
1297: break;
1298: }
1299: break;
1300: }
1301:
1302: return(fFalse);
1303: }
1304:
1305:
1306:
1307: /*
1308: ** Purpose:
1309: ** Get Name and Organization Dialog procedure for templates
1310: ** with two Edit controls.
1311: ** (Limits the input string length to cbNameMax characters.)
1312: **
1313: ** Controls Recognized:
1314: ** Edit - IDC_EDIT, IDC_EDIT2
1315: ** Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
1316: **
1317: ** Initialization Symbols:
1318: ** none.
1319: **
1320: ** Termination Symbols:
1321: ** "NameOut" - text in the IDC_EDIT edit control upon termination.
1322: ** "OrgOut" - text in the IDC_EDIT2 edit control upon termination.
1323: ** "DLGEVENT" - one of the following, depending on event:
1324: ** event value
1325: ** ---------- ----------
1326: ** IDC_B "BACK"
1327: ** IDC_C "CONTINUE"
1328: ** IDC_X "EXIT"
1329: ** IDCANCEL "CANCEL"
1330: **
1331: ** Note:
1332: ** Pushbutton IDC_H will open the related Help dialog, if any.
1333: **
1334: *****************************************************************************/
1335: BOOL FAR PASCAL FNameOrgDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
1336: {
1337: static WORD wSelStart1 = 0;
1338: static WORD wSelEnd1 = 0;
1339: static WORD wSelStart2 = 0;
1340: static WORD wSelEnd2 = 0;
1341: char rgchText[cbNameMax + 1];
1342:
1343: switch (wMsg)
1344: {
1345: case WM_INITDIALOG:
1346: SendDlgItemMessage(hdlg, IDC_EDIT, EM_LIMITTEXT, cbNameMax, 0L);
1347: SetDlgItemText(hdlg, IDC_EDIT, (LPSTR)"");
1348:
1349: SendDlgItemMessage(hdlg, IDC_EDIT2, EM_LIMITTEXT, cbNameMax, 0L);
1350: SetDlgItemText(hdlg, IDC_EDIT2, (LPSTR)"");
1351:
1352: wSelStart1 = wSelEnd1 = 0;
1353: wSelStart2 = wSelEnd2 = 0;
1354: return(fTrue);
1355:
1356: case STF_REINITDIALOG:
1357: SendDlgItemMessage(hdlg, IDC_EDIT, EM_SETSEL, 0, MAKELONG(256, 256));
1358: SetFocus(GetDlgItem(hdlg, IDC_EDIT));
1359: return(fTrue);
1360:
1361: case STF_ACTIVATEAPP:
1362: return(fTrue);
1363:
1364: case WM_COMMAND:
1365: switch(wParam)
1366: {
1367: case IDC_EDIT:
1368: if (HIWORD(lParam) == EN_SETFOCUS)
1369: SendDlgItemMessage(hdlg, IDC_EDIT, EM_SETSEL, 0,
1370: MAKELONG(wSelStart1, wSelEnd1));
1371: else if (HIWORD(lParam) == EN_KILLFOCUS)
1372: {
1373: LONG l = SendDlgItemMessage(hdlg, IDC_EDIT, EM_GETSEL, 0, 0L);
1374:
1375: wSelStart1 = LOWORD(l);
1376: wSelEnd1 = HIWORD(l);
1377: }
1378: break;
1379:
1380: case IDC_EDIT2:
1381: if (HIWORD(lParam) == EN_SETFOCUS)
1382: SendDlgItemMessage(hdlg, IDC_EDIT2, EM_SETSEL, 0,
1383: MAKELONG(wSelStart2, wSelEnd2));
1384: else if (HIWORD(lParam) == EN_KILLFOCUS)
1385: {
1386: LONG l = SendDlgItemMessage(hdlg, IDC_EDIT2, EM_GETSEL, 0, 0L);
1387:
1388: wSelStart2 = LOWORD(l);
1389: wSelEnd2 = HIWORD(l);
1390: }
1391: break;
1392:
1393: case IDC_H:
1394: HdlgShowHelp();
1395: return(fTrue);
1396:
1397: case IDC_B:
1398: case IDC_C:
1399: case IDC_X:
1400: case IDCANCEL:
1401: if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
1402: {
1403: DestroyWindow(GetParent(hdlg));
1404: return(fTrue);
1405: }
1406:
1407: SendDlgItemMessage(hdlg, IDC_EDIT, (WORD)WM_GETTEXT,
1408: cbNameMax + 1, (LONG)((LPSTR)rgchText));
1409: if (!FSetSymbolValue("NameOut", rgchText))
1410: {
1411: DestroyWindow(GetParent(hdlg));
1412: return(fTrue);
1413: }
1414:
1415: SendDlgItemMessage(hdlg, IDC_EDIT2, (WORD)WM_GETTEXT,
1416: cbNameMax + 1, (LONG)((LPSTR)rgchText));
1417: if (!FSetSymbolValue("OrgOut", rgchText))
1418: {
1419: DestroyWindow(GetParent(hdlg));
1420: return(fTrue);
1421: }
1422:
1423: ReactivateSetupScript();
1424: break;
1425: }
1426: break;
1427: }
1428:
1429: return(fFalse);
1430: }
1431:
1432:
1433:
1434: /*
1435: ** Purpose:
1436: ** Confirm Info Dialog procedure for templates with one to
1437: ** static text controls.
1438: **
1439: ** Controls Recognized:
1440: ** Text - IDC_TEXT1 to IDC_TEXT10 (sequential)
1441: ** Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
1442: **
1443: ** Initialization Symbols:
1444: ** "ConfirmTextIn" - list of up to ten string items to initialize
1445: ** static text items (IDC_TEXT1-10).
1446: **
1447: ** Termination Symbols:
1448: ** "DLGEVENT" - one of the following, depending on event:
1449: ** event value
1450: ** ---------- ----------
1451: ** IDC_B "BACK"
1452: ** IDC_C "CONTINUE"
1453: ** IDC_X "EXIT"
1454: ** IDCANCEL "CANCEL"
1455: **
1456: ** Note:
1457: ** Pushbutton IDC_H will open the related Help dialog, if any.
1458: **
1459: *****************************************************************************/
1460: BOOL FAR PASCAL FConfirmDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
1461: {
1462: WORD idc;
1463: WORD cItems;
1464: WORD i, cb;
1465: char szSymBuf[cbSymBuf];
1466:
1467: switch (wMsg)
1468: {
1469: case WM_INITDIALOG:
1470: cItems = UsGetListLength("ConfirmTextIn");
1471: idc = IDC_TEXT1;
1472: for (i = 1; i <= cItems; ++i)
1473: {
1474: WORD wCheck = 0;
1475:
1476: cb = CbGetListItem("ConfirmTextIn", i, szSymBuf, cbSymBuf);
1477: Assert(cb < cbSymBuf);
1478: SetDlgItemText(hdlg, idc++, szSymBuf);
1479: if (i >= 4
1480: && i <= 6)
1481: {
1482: if (*szSymBuf == '\0')
1483: ShowWindow(GetDlgItem(hdlg, IDC_TEXT4+i), SW_HIDE);
1484: else
1485: ShowWindow(GetDlgItem(hdlg, IDC_TEXT4+i), SW_SHOWNOACTIVATE);
1486: }
1487: }
1488: return(fTrue);
1489:
1490: case STF_REINITDIALOG:
1491: case STF_ACTIVATEAPP:
1492: return(fTrue);
1493:
1494: case WM_COMMAND:
1495: switch (wParam)
1496: {
1497: case IDC_H:
1498: HdlgShowHelp();
1499: return(fTrue);
1500:
1501: case IDC_B:
1502: case IDC_C:
1503: case IDC_X:
1504: case IDCANCEL:
1505: if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
1506: {
1507: DestroyWindow(GetParent(hdlg));
1508: return(fTrue);
1509: }
1510: ReactivateSetupScript();
1511: break;
1512: }
1513: break;
1514: }
1515:
1516: return(fFalse);
1517: }
1518:
1519:
1520:
1521: /*
1522: ** Purpose:
1523: ** Initialization routine for DLL.
1524: ** Arguments:
1525: ** hInst: handle to instance of App that required this DLL.
1526: ** wDataSeg: number of words in DLL's data segment.
1527: ** wHeapSize: number of bytes in DLL's heap.
1528: ** lpszCmdLine: command line for App that required this DLL.
1529: ** Returns:
1530: ** 1 always
1531: *****************************************************************************/
1532: int FAR PASCAL LibMain(HANDLE hInst, WORD wDataSeg, WORD wHeapSize,
1533: LPSTR lpszCmdLine)
1534: {
1535: if (wHeapSize > 0)
1536: UnlockData(0);
1537:
1538: return(1);
1539: }
1540:
1541:
1542:
1543: /*
1544: ** Purpose:
1545: ** Windows Exit Procedure.
1546: ** Arguments:
1547: ** nParam: standard WEP param (ignored).
1548: ** Returns:
1549: ** 1 always.
1550: *****************************************************************************/
1551: int FAR PASCAL WEP (int nParam)
1552: {
1553: return(1);
1554: }
1555:
1556:
1557:
1558: /*
1559: ** Purpose:
1560: ** Finds the last character in a string.
1561: ** Arguments:
1562: ** sz: non-NULL zero terminated string to search.
1563: ** Returns:
1564: ** NULL for an empty string.
1565: ** non-Null string pointer to the last valid character in sz.
1566: *****************************************************************************/
1567: LPSTR FAR PASCAL SzLastChar(LPSTR sz)
1568: {
1569: LPSTR szCur = (LPSTR)NULL;
1570: LPSTR szNext = sz;
1571:
1572: while (*szNext != '\0')
1573: szNext = AnsiNext((szCur = szNext));
1574:
1575: return(szCur);
1576: }
1577:
1578:
1579:
1580: /*
1581: ** Purpose:
1582: ** Gets the string values for the following WM_COMMAND events:
1583: ** IDC_B, IDC_C, IDC_X, and IDCANCEL.
1584: ** Arguments:
1585: ** wParam: event parameter value
1586: ** Returns:
1587: ** Pointer to string value constant, NULL if unknown event.
1588: *****************************************************************************/
1589: LPSTR FAR PASCAL SzDlgEvent(WORD wParam)
1590: {
1591: LPSTR szEvent;
1592:
1593: switch(wParam)
1594: {
1595: case IDC_B:
1596: szEvent = "BACK";
1597: break;
1598: case IDC_C:
1599: szEvent = "CONTINUE";
1600: break;
1601: case IDC_X:
1602: szEvent = "EXIT";
1603: break;
1604: case IDCANCEL:
1605: szEvent = "CANCEL";
1606: break;
1607: default:
1608: szEvent = NULL;
1609: break;
1610: }
1611:
1612: return(szEvent);
1613: }
1614:
1615:
1616:
1617: /*
1618: ** Purpose:
1619: ** Converts an ASCII string representing a positive value
1620: ** into an integer.
1621: ** Arguments:
1622: ** sz: non-NULL zero terminated string to convert.
1623: ** Returns:
1624: ** Integer represented by the string.
1625: *****************************************************************************/
1626: int FAR PASCAL AsciiToInt(LPSTR sz)
1627: {
1628: int i = 0;
1629:
1630: while (*sz == ' ' || *sz == '\t')
1631: sz++;
1632:
1633: while (isdigit(*sz))
1634: i = (i * 10) + *sz++ - '0';
1635:
1636: return(i);
1637: }
1638:
1639:
1640:
1641: /*
1642: ** Purpose:
1643: ** Converts an positive integer (< 100) into a string
1644: ** representing its value.
1645: ** Arguments:
1646: ** i: integer to convert (positive and < 100).
1647: ** sz: buffer to hold converted string (at least 3 bytes).
1648: ** Returns:
1649: ** sz.
1650: *****************************************************************************/
1651: LPSTR FAR PASCAL IntToAscii(int i, LPSTR sz)
1652: {
1653: LPSTR szSav = sz;
1654:
1655: if (i >= 100
1656: || i < 0)
1657: Assert(fFalse);
1658:
1659: if (i >= 10)
1660: {
1661: *sz++ = (char)('0' + (i / 10));
1662: i %= 10;
1663: }
1664: *sz++ = (char)('0' + i);
1665: *sz = '\0';
1666:
1667: return(szSav);
1668: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.