| [377] | 1 |  | 
|---|
|  | 2 | /*********************************************************************** | 
|---|
|  | 3 |  | 
|---|
|  | 4 | $Id: objwin.c 593 2007-03-31 19:13:59Z gyoung $ | 
|---|
|  | 5 |  | 
|---|
|  | 6 | Object windows | 
|---|
|  | 7 |  | 
|---|
|  | 8 | Copyright (c) 1993-98 M. Kimes | 
|---|
|  | 9 | Copyright (c) 2006 Steven H.Levine | 
|---|
|  | 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 | 
|---|
| [377] | 14 |  | 
|---|
|  | 15 | ***********************************************************************/ | 
|---|
|  | 16 |  | 
|---|
| [2] | 17 | #define INCL_DOS | 
|---|
|  | 18 | #define INCL_WIN | 
|---|
|  | 19 | #define INCL_GPI | 
|---|
| [377] | 20 | #include <os2.h> | 
|---|
| [2] | 21 |  | 
|---|
|  | 22 | #include <stdarg.h> | 
|---|
|  | 23 | #include <stdio.h> | 
|---|
|  | 24 | #include <stdlib.h> | 
|---|
|  | 25 | #include <string.h> | 
|---|
|  | 26 | #include <ctype.h> | 
|---|
|  | 27 | #include <stddef.h> | 
|---|
| [377] | 28 |  | 
|---|
| [2] | 29 | #include "fm3dll.h" | 
|---|
|  | 30 | #include "fm3dlg.h" | 
|---|
|  | 31 | #include "fm3str.h" | 
|---|
|  | 32 |  | 
|---|
| [377] | 33 | static PSZ pszSrcFile = __FILE__; | 
|---|
|  | 34 |  | 
|---|
| [2] | 35 | #pragma alloc_text(OBJWIN,ObjectWndProc,MakeObjWin) | 
|---|
|  | 36 |  | 
|---|
| [551] | 37 | MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| [413] | 38 | { | 
|---|
| [2] | 39 | DIRCNRDATA *dcd; | 
|---|
|  | 40 |  | 
|---|
| [551] | 41 | dcd = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
|  | 42 | if (dcd) { | 
|---|
|  | 43 | switch (dcd->type) { | 
|---|
|  | 44 | case DIR_FRAME: | 
|---|
|  | 45 | return DirObjWndProc(hwnd, msg, mp1, mp2); | 
|---|
|  | 46 | case TREE_FRAME: | 
|---|
|  | 47 | return TreeObjWndProc(hwnd, msg, mp1, mp2); | 
|---|
|  | 48 | case COLLECTOR_FRAME: | 
|---|
|  | 49 | return CollectorObjWndProc(hwnd, msg, mp1, mp2); | 
|---|
|  | 50 | case ARC_FRAME: | 
|---|
|  | 51 | return ArcObjWndProc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 52 | } | 
|---|
|  | 53 | } | 
|---|
| [551] | 54 | return WinDefWindowProc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 55 | } | 
|---|
|  | 56 |  | 
|---|
| [551] | 57 | VOID MakeObjWin(VOID * args) | 
|---|
| [413] | 58 | { | 
|---|
| [551] | 59 | HWND ObjectHwnd; | 
|---|
|  | 60 | HAB hab2; | 
|---|
|  | 61 | HMQ hmq2; | 
|---|
|  | 62 | QMSG qmsg2; | 
|---|
| [2] | 63 |  | 
|---|
|  | 64 | hab2 = WinInitialize(0); | 
|---|
| [551] | 65 | if (hab2) { | 
|---|
|  | 66 | hmq2 = WinCreateMsgQueue(hab2, 512); | 
|---|
|  | 67 | if (hmq2) { | 
|---|
| [2] | 68 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 69 | WinRegisterClass(hab2, | 
|---|
| [593] | 70 | WC_OBJECTWINDOW, | 
|---|
| [551] | 71 | ObjectWndProc, 0, sizeof(PVOID)); | 
|---|
| [2] | 72 | ObjectHwnd = WinCreateWindow(HWND_OBJECT, | 
|---|
| [593] | 73 | WC_OBJECTWINDOW, | 
|---|
| [551] | 74 | (PSZ) NULL, | 
|---|
|  | 75 | 0, | 
|---|
|  | 76 | 0L, | 
|---|
|  | 77 | 0L, | 
|---|
|  | 78 | 0L, | 
|---|
|  | 79 | 0L, 0L, HWND_TOP, OBJ_FRAME, NULL, NULL); | 
|---|
| [377] | 80 | if (!ObjectHwnd) | 
|---|
| [551] | 81 | Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
|  | 82 | IDS_WINCREATEWINDOW); | 
|---|
| [377] | 83 | else { | 
|---|
| [551] | 84 | WinSetWindowPtr(ObjectHwnd, QWL_USER, args); | 
|---|
|  | 85 | /* initially populate container */ | 
|---|
|  | 86 | WinSendMsg(ObjectHwnd, UM_SETUP, MPVOID, MPVOID); | 
|---|
|  | 87 | PostMsg(ObjectHwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 88 | priority_normal(); | 
|---|
|  | 89 | while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0)) | 
|---|
|  | 90 | WinDispatchMsg(hab2, &qmsg2); | 
|---|
|  | 91 | WinDestroyWindow(ObjectHwnd); | 
|---|
| [2] | 92 | } | 
|---|
|  | 93 | WinDestroyMsgQueue(hmq2); | 
|---|
|  | 94 | } | 
|---|
|  | 95 | WinTerminate(hab2); | 
|---|
|  | 96 | } | 
|---|
|  | 97 | } | 
|---|