|
|
1.1 ! root 1: /* mboxtest.c - Message box control test application */ ! 2: /* Created by Microsoft Corp., 1988 */ ! 3: /* */ ! 4: #define INCL_WIN ! 5: #include <os2.h> ! 6: #include "mboxtest.h" ! 7: ! 8: /************* GLOBAL VARIABLES */ ! 9: char szMboxtestClass[] = "Mboxtest"; ! 10: char szAppName[] = "Mboxtest Application"; ! 11: HAB habMboxtest; ! 12: HMQ hmqMboxtest; ! 13: HWND hwndMboxtest; ! 14: HWND hwndMboxtestFrame; ! 15: void FAR PASCAL WinExitWindows(PCH); ! 16: ! 17: ! 18: /************* PROCEDURE DECLARATIONS */ ! 19: MPARAM FAR PASCAL MboxDlgProc(HWND, USHORT, MPARAM, MPARAM); ! 20: BOOL MboxtestInit() ! 21: { ! 22: /* ! 23: * Initialize the HAB ! 24: * (just set to -1L for now until we get WinInitialize() ! 25: */ ! 26: habMboxtest = WinInitialize(NULL); ! 27: hmqMboxtest = WinCreateMsgQueue(habMboxtest, 0); ! 28: return(TRUE); ! 29: } ! 30: ! 31: ! 32: int cdecl main(argc, argv) ! 33: int argc; ! 34: char *argv[]; ! 35: { ! 36: QMSG qmsg; ! 37: USHORT wResult; ! 38: WRECT rc; ! 39: if (!MboxtestInit()) ! 40: return(0); ! 41: wResult = WinDlgBox(HWND_DESKTOP, (HWND)NULL, (PFNWP)MboxDlgProc, ! 42: (HMODULE)NULL, IDD_MBOXTEST, (PCH)NULL); ! 43: WinDestroyMsgQueue(hmqMboxtest); ! 44: WinTerminate(habMboxtest); ! 45: DosExit(EXIT_PROCESS, 0); ! 46: } ! 47: ! 48: ! 49: MPARAM FAR PASCAL MboxDlgProc(hwnd, msg, mp1, mp2) ! 50: HWND hwnd; ! 51: USHORT msg; ! 52: MPARAM mp1; ! 53: MPARAM mp2; ! 54: { ! 55: USHORT word, flStyle; ! 56: HWND hwnd1 = 0, hwndResult; ! 57: CHAR rgch[256]; ! 58: BOOL fParse; ! 59: INT i; ! 60: ! 61: hwndResult = WinWindowFromID(hwnd, 31); /* Result edit control */ ! 62: ! 63: switch (msg) { ! 64: case WM_COMMAND: ! 65: switch (LOUSHORT(mp1)) { ! 66: case DID_OK: ! 67: WinDismissDlg(hwnd, 1234); ! 68: break; ! 69: ! 70: case 30: /* Show Box */ ! 71: flStyle = (USHORT)WinSendDlgItemMsg(hwnd, 13, BM_QUERYCHECKINDEX, ! 72: (MPARAM)hwnd, 0L); ! 73: i = (INT)WinSendDlgItemMsg(hwnd, 22, BM_QUERYCHECKINDEX, ! 74: (MPARAM)hwnd, 0L); ! 75: flStyle = (flStyle & 0xff0f) | (i << 4); ! 76: i = (INT)WinSendDlgItemMsg(hwnd, 27, BM_QUERYCHECKINDEX, ! 77: (MPARAM)hwnd, 0L); ! 78: flStyle = (flStyle & 0xf0ff) | (i << 8); ! 79: ! 80: /* Test message box system modality */ ! 81: i = (INT)WinSendDlgItemMsg(hwnd, 31, BM_QUERYCHECK, 0L, 0L); ! 82: if (i) ! 83: flStyle |= MB_SYSTEMMODAL; ! 84: ! 85: /* Test message box help button attribute */ ! 86: i = (INT)WinSendDlgItemMsg(hwnd, 32, BM_QUERYCHECK, 0L, 0L); ! 87: if (i) ! 88: flStyle |= MB_HELP; ! 89: ! 90: WinSetDlgItemShort(hwnd, 43, flStyle, FALSE); ! 91: i = (INT)WinMessageBox(HWND_DESKTOP, hwnd, ! 92: (PSZ)"This is where the body of the message box text \ ! 93: goes. It can contain\nseveral lines.", ! 94: (PSZ)"This is the title bar", 1, flStyle); ! 95: ! 96: WinSetDlgItemShort(hwnd, 51, i, FALSE); ! 97: break; ! 98: ! 99: default: ! 100: break; ! 101: } ! 102: break; ! 103: ! 104: case WM_INITDLG: ! 105: WinSendDlgItemMsg(hwnd, 13, BM_SETCHECK, (MPARAM)TRUE, 0L); ! 106: WinSendDlgItemMsg(hwnd, 22, BM_SETCHECK, (MPARAM)TRUE, 0L); ! 107: WinSendDlgItemMsg(hwnd, 27, BM_SETCHECK, (MPARAM)TRUE, 0L); ! 108: break; ! 109: ! 110: default: ! 111: return(WinDefDlgProc(hwnd, msg, mp1, mp2)); ! 112: break; ! 113: } ! 114: return 0L; ! 115: } ! 116: ! 117: ! 118: CvtDec(wValue, lplpch) ! 119: register USHORT wValue; ! 120: PSZ far *lplpch; ! 121: { ! 122: if (wValue >= 10) { ! 123: CvtDec(wValue / 10, lplpch); ! 124: wValue %= 10; ! 125: } ! 126: *(*lplpch)++ = wValue + '0'; ! 127: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.