[377] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: objwin.c 1062 2008-07-08 20:57:26Z stevenhl $
|
---|
| 5 |
|
---|
| 6 | Object windows
|
---|
| 7 |
|
---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
---|
[1062] | 9 | Copyright (c) 2006, 2008 Steven H.Levine
|
---|
[377] | 10 |
|
---|
| 11 | 26 Jul 06 SHL Check more run time errors
|
---|
[516] | 12 | 02 Nov 06 SHL Comments
|
---|
[593] | 13 | 30 Mar 07 GKY Remove GetPString for window class names
|
---|
[793] | 14 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
|
---|
[1062] | 15 | 08 Jul 08 SHL Correct Fortify_LeaveScope usage and avoid spurious reports
|
---|
[377] | 16 |
|
---|
| 17 | ***********************************************************************/
|
---|
| 18 |
|
---|
[2] | 19 | #define INCL_DOS
|
---|
| 20 | #define INCL_WIN
|
---|
[907] | 21 | #define INCL_LONGLONG // dircnrs.h
|
---|
[2] | 22 |
|
---|
| 23 | #include "fm3dlg.h"
|
---|
| 24 | #include "fm3str.h"
|
---|
[907] | 25 | #include "arccnrs.h" // ArcObjWndProc
|
---|
| 26 | #include "errutil.h" // Win_Error
|
---|
| 27 | #include "fm3dll.h"
|
---|
[1032] | 28 | #include "fortify.h"
|
---|
[2] | 29 |
|
---|
[377] | 30 | static PSZ pszSrcFile = __FILE__;
|
---|
| 31 |
|
---|
[551] | 32 | MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
[413] | 33 | {
|
---|
[2] | 34 | DIRCNRDATA *dcd;
|
---|
| 35 |
|
---|
[551] | 36 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 37 | if (dcd) {
|
---|
| 38 | switch (dcd->type) {
|
---|
| 39 | case DIR_FRAME:
|
---|
| 40 | return DirObjWndProc(hwnd, msg, mp1, mp2);
|
---|
| 41 | case TREE_FRAME:
|
---|
| 42 | return TreeObjWndProc(hwnd, msg, mp1, mp2);
|
---|
| 43 | case COLLECTOR_FRAME:
|
---|
| 44 | return CollectorObjWndProc(hwnd, msg, mp1, mp2);
|
---|
| 45 | case ARC_FRAME:
|
---|
| 46 | return ArcObjWndProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 47 | }
|
---|
| 48 | }
|
---|
[551] | 49 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 50 | }
|
---|
| 51 |
|
---|
[551] | 52 | VOID MakeObjWin(VOID * args)
|
---|
[413] | 53 | {
|
---|
[551] | 54 | HWND ObjectHwnd;
|
---|
| 55 | HAB hab2;
|
---|
| 56 | HMQ hmq2;
|
---|
| 57 | QMSG qmsg2;
|
---|
[2] | 58 |
|
---|
| 59 | hab2 = WinInitialize(0);
|
---|
[551] | 60 | if (hab2) {
|
---|
| 61 | hmq2 = WinCreateMsgQueue(hab2, 512);
|
---|
| 62 | if (hmq2) {
|
---|
[2] | 63 | DosError(FERR_DISABLEHARDERR);
|
---|
| 64 | WinRegisterClass(hab2,
|
---|
[593] | 65 | WC_OBJECTWINDOW,
|
---|
[551] | 66 | ObjectWndProc, 0, sizeof(PVOID));
|
---|
[2] | 67 | ObjectHwnd = WinCreateWindow(HWND_OBJECT,
|
---|
[593] | 68 | WC_OBJECTWINDOW,
|
---|
[551] | 69 | (PSZ) NULL,
|
---|
| 70 | 0,
|
---|
| 71 | 0L,
|
---|
| 72 | 0L,
|
---|
| 73 | 0L,
|
---|
| 74 | 0L, 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
|
---|
[377] | 75 | if (!ObjectHwnd)
|
---|
[551] | 76 | Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 77 | IDS_WINCREATEWINDOW);
|
---|
[377] | 78 | else {
|
---|
[1062] | 79 | #ifdef FORTIFY
|
---|
| 80 | Fortify_EnterScope();
|
---|
| 81 | #endif
|
---|
[551] | 82 | WinSetWindowPtr(ObjectHwnd, QWL_USER, args);
|
---|
| 83 | /* initially populate container */
|
---|
| 84 | WinSendMsg(ObjectHwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
| 85 | PostMsg(ObjectHwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 86 | priority_normal();
|
---|
| 87 | while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))
|
---|
| 88 | WinDispatchMsg(hab2, &qmsg2);
|
---|
| 89 | WinDestroyWindow(ObjectHwnd);
|
---|
[1062] | 90 | #ifdef FORTIFY
|
---|
| 91 | {
|
---|
| 92 | HWND hwndCnr = ((DIRCNRDATA *)args)->hwndCnr;
|
---|
| 93 | USHORT i;
|
---|
| 94 | // Allow container to close and free data
|
---|
| 95 | for (i = 0; WinIsWindow(hab2, hwndCnr) && i < 10; i++) {
|
---|
| 96 | DosSleep(50);
|
---|
| 97 | }
|
---|
| 98 | Fortify_LeaveScope();
|
---|
| 99 | }
|
---|
| 100 | #endif
|
---|
[2] | 101 | }
|
---|
| 102 | WinDestroyMsgQueue(hmq2);
|
---|
| 103 | }
|
---|
| 104 | WinTerminate(hab2);
|
---|
| 105 | }
|
---|
| 106 | }
|
---|
[793] | 107 |
|
---|
| 108 | #pragma alloc_text(OBJWIN,ObjectWndProc,MakeObjWin)
|
---|