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