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