home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.os2.programmer
- Path: sparky!uunet!darwin.sura.net!Sirius.dfn.de!chx400!bernina!neptune!ezeller
- From: ezeller@iiic.ethz.ch (Emil Johann Zeller)
- Subject: Problem with checkbox
- Message-ID: <1992Jul29.065258.19484@neptune.inf.ethz.ch>
- Sender: news@neptune.inf.ethz.ch (Mr News)
- Nntp-Posting-Host: c16
- Organization: Dept. Informatik, Swiss Federal Institute of Technology (ETH)
- Distribution: usa, local
- Date: Wed, 29 Jul 1992 06:52:58 GMT
- Lines: 76
-
- #define INCL_WIN
- #include <os2.h>
-
- MRESULT ClientWinProc(HWND, USHORT, MPARAM, MPARAM);
-
- #define ID_BUTTON 1
- #define CWPM_CREATE WM_USER
-
- main()
- {
- HAB hab;
- HMQ hmq;
- QMSG qmsg;
- HWND hwndFrame, hwndClient;
-
- ULONG flCreateFlags = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER |
- FCF_MINMAX | FCF_SHELLPOSITION | FCF_TASKLIST;
-
- static CHAR szClientClass[] = "Client Messages";
-
- hab = WinInitialize(0);
- hmq = WinCreateMsgQueue(hab, 0);
-
- WinRegisterClass(hab, szClientClass, ClientWinProc, CS_SIZEREDRAW, 0);
-
- hwndFrame = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE, &flCreateFlags,
- szClientClass, " - Controls", 0L, (HMODULE) NULL, 0, &hwndClient);
-
- while (WinGetMsg(hab, &qmsg, NULL, 0, 0))
- WinDispatchMsg(hab, &qmsg);
-
- WinDestroyWindow(hwndFrame);
- WinDestroyMsgQueue(hmq);
- WinTerminate(hab);
-
- return 0;
- }
-
- MRESULT ClientWinProc(HWND hwnd, USHORT msg, MPARAM mp1,
- MPARAM mp2)
- {
- HWND hwndControl;
- RECTL rcl;
- SHORT cx, cy;
-
- switch (msg)
- {
- case WM_CREATE:
- WinPostMsg(hwnd, CWPM_CREATE, NULL, NULL);
- return FALSE;
- break;
-
- case CWPM_CREATE:
- WinQueryWindowRect(hwnd, &rcl);
- cx = (SHORT)((rcl.xRight - rcl.xLeft) / 2);
- cy = (SHORT)((rcl.yTop -rcl.yBottom) / 2);
- hwndControl = WinCreateWindow(hwnd, WC_BUTTON, "Beep on WM_PAINT", WS_VISIBLE | BS_AUTOCHECKBOX,
- cx - 100, cy - 10, 200, 20, hwnd, HWND_TOP, ID_BUTTON, NULL, NULL);
- break;
-
- case WM_PAINT:
- if (SHORT1FROMMR(WinSendMsg(hwndControl, BM_QUERYCHECK, NULL, NULL))) WinAlarm(HWND_DESKTOP, WA_NOTE);
- return(WinDefWindowProc(hwnd, msg, mp1, mp2));
- break;
-
- case WM_ERASEBACKGROUND:
- return TRUE;
- break;
-
- default:
- return(WinDefWindowProc(hwnd, msg, mp1, mp2));
- break;
- }
-
- return NULL;
- }
-