| 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 | 
|---|
| 12 | 02 Nov 06 SHL Comments | 
|---|
| 13 | 30 Mar 07 GKY Remove GetPString for window class names | 
|---|
| 14 |  | 
|---|
| 15 | ***********************************************************************/ | 
|---|
| 16 |  | 
|---|
| 17 | #define INCL_DOS | 
|---|
| 18 | #define INCL_WIN | 
|---|
| 19 | #define INCL_GPI | 
|---|
| 20 | #include <os2.h> | 
|---|
| 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> | 
|---|
| 28 |  | 
|---|
| 29 | #include "fm3dll.h" | 
|---|
| 30 | #include "fm3dlg.h" | 
|---|
| 31 | #include "fm3str.h" | 
|---|
| 32 |  | 
|---|
| 33 | static PSZ pszSrcFile = __FILE__; | 
|---|
| 34 |  | 
|---|
| 35 | #pragma alloc_text(OBJWIN,ObjectWndProc,MakeObjWin) | 
|---|
| 36 |  | 
|---|
| 37 | MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| 38 | { | 
|---|
| 39 | DIRCNRDATA *dcd; | 
|---|
| 40 |  | 
|---|
| 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); | 
|---|
| 52 | } | 
|---|
| 53 | } | 
|---|
| 54 | return WinDefWindowProc(hwnd, msg, mp1, mp2); | 
|---|
| 55 | } | 
|---|
| 56 |  | 
|---|
| 57 | VOID MakeObjWin(VOID * args) | 
|---|
| 58 | { | 
|---|
| 59 | HWND ObjectHwnd; | 
|---|
| 60 | HAB hab2; | 
|---|
| 61 | HMQ hmq2; | 
|---|
| 62 | QMSG qmsg2; | 
|---|
| 63 |  | 
|---|
| 64 | hab2 = WinInitialize(0); | 
|---|
| 65 | if (hab2) { | 
|---|
| 66 | hmq2 = WinCreateMsgQueue(hab2, 512); | 
|---|
| 67 | if (hmq2) { | 
|---|
| 68 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 69 | WinRegisterClass(hab2, | 
|---|
| 70 | WC_OBJECTWINDOW, | 
|---|
| 71 | ObjectWndProc, 0, sizeof(PVOID)); | 
|---|
| 72 | ObjectHwnd = WinCreateWindow(HWND_OBJECT, | 
|---|
| 73 | WC_OBJECTWINDOW, | 
|---|
| 74 | (PSZ) NULL, | 
|---|
| 75 | 0, | 
|---|
| 76 | 0L, | 
|---|
| 77 | 0L, | 
|---|
| 78 | 0L, | 
|---|
| 79 | 0L, 0L, HWND_TOP, OBJ_FRAME, NULL, NULL); | 
|---|
| 80 | if (!ObjectHwnd) | 
|---|
| 81 | Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| 82 | IDS_WINCREATEWINDOW); | 
|---|
| 83 | else { | 
|---|
| 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); | 
|---|
| 92 | } | 
|---|
| 93 | WinDestroyMsgQueue(hmq2); | 
|---|
| 94 | } | 
|---|
| 95 | WinTerminate(hab2); | 
|---|
| 96 | } | 
|---|
| 97 | } | 
|---|