|
|
Microsoft OS/2 SDK PM 08-08-1988
/* mboxtest.c - Message box control test application */
/* Created by Microsoft Corp., 1988 */
/* */
#define INCL_WIN
#include <os2.h>
#include "mboxtest.h"
/************* GLOBAL VARIABLES */
char szMboxtestClass[] = "Mboxtest";
char szAppName[] = "Mboxtest Application";
HAB habMboxtest;
HMQ hmqMboxtest;
HWND hwndMboxtest;
HWND hwndMboxtestFrame;
void FAR PASCAL WinExitWindows(PCH);
/************* PROCEDURE DECLARATIONS */
MPARAM FAR PASCAL MboxDlgProc(HWND, USHORT, MPARAM, MPARAM);
BOOL MboxtestInit()
{
/*
* Initialize the HAB
* (just set to -1L for now until we get WinInitialize()
*/
habMboxtest = WinInitialize(NULL);
hmqMboxtest = WinCreateMsgQueue(habMboxtest, 0);
return(TRUE);
}
int cdecl main(argc, argv)
int argc;
char *argv[];
{
QMSG qmsg;
USHORT wResult;
WRECT rc;
if (!MboxtestInit())
return(0);
wResult = WinDlgBox(HWND_DESKTOP, (HWND)NULL, (PFNWP)MboxDlgProc,
(HMODULE)NULL, IDD_MBOXTEST, (PCH)NULL);
WinDestroyMsgQueue(hmqMboxtest);
WinTerminate(habMboxtest);
DosExit(EXIT_PROCESS, 0);
}
MPARAM FAR PASCAL MboxDlgProc(hwnd, msg, mp1, mp2)
HWND hwnd;
USHORT msg;
MPARAM mp1;
MPARAM mp2;
{
USHORT word, flStyle;
HWND hwnd1 = 0, hwndResult;
CHAR rgch[256];
BOOL fParse;
INT i;
hwndResult = WinWindowFromID(hwnd, 31); /* Result edit control */
switch (msg) {
case WM_COMMAND:
switch (LOUSHORT(mp1)) {
case DID_OK:
WinDismissDlg(hwnd, 1234);
break;
case 30: /* Show Box */
flStyle = (USHORT)WinSendDlgItemMsg(hwnd, 13, BM_QUERYCHECKINDEX,
(MPARAM)hwnd, 0L);
i = (INT)WinSendDlgItemMsg(hwnd, 22, BM_QUERYCHECKINDEX,
(MPARAM)hwnd, 0L);
flStyle = (flStyle & 0xff0f) | (i << 4);
i = (INT)WinSendDlgItemMsg(hwnd, 27, BM_QUERYCHECKINDEX,
(MPARAM)hwnd, 0L);
flStyle = (flStyle & 0xf0ff) | (i << 8);
/* Test message box system modality */
i = (INT)WinSendDlgItemMsg(hwnd, 31, BM_QUERYCHECK, 0L, 0L);
if (i)
flStyle |= MB_SYSTEMMODAL;
/* Test message box help button attribute */
i = (INT)WinSendDlgItemMsg(hwnd, 32, BM_QUERYCHECK, 0L, 0L);
if (i)
flStyle |= MB_HELP;
WinSetDlgItemShort(hwnd, 43, flStyle, FALSE);
i = (INT)WinMessageBox(HWND_DESKTOP, hwnd,
(PSZ)"This is where the body of the message box text \
goes. It can contain\nseveral lines.",
(PSZ)"This is the title bar", 1, flStyle);
WinSetDlgItemShort(hwnd, 51, i, FALSE);
break;
default:
break;
}
break;
case WM_INITDLG:
WinSendDlgItemMsg(hwnd, 13, BM_SETCHECK, (MPARAM)TRUE, 0L);
WinSendDlgItemMsg(hwnd, 22, BM_SETCHECK, (MPARAM)TRUE, 0L);
WinSendDlgItemMsg(hwnd, 27, BM_SETCHECK, (MPARAM)TRUE, 0L);
break;
default:
return(WinDefDlgProc(hwnd, msg, mp1, mp2));
break;
}
return 0L;
}
CvtDec(wValue, lplpch)
register USHORT wValue;
PSZ far *lplpch;
{
if (wValue >= 10) {
CvtDec(wValue / 10, lplpch);
wValue %= 10;
}
*(*lplpch)++ = wValue + '0';
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.