source: trunk/dll/objwin.c

Last change on this file was 1673, checked in by Gregg Young, 13 years ago

Update to Doxygen comment style Ticket 55. Also some minor code cleanup.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1
2/***********************************************************************
3
4 $Id: objwin.c 1673 2012-12-30 18:51:01Z gyoung $
5
6 Object windows
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2006, 2010 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 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
15 08 Jul 08 SHL Correct Fortify_LeaveScope usage and avoid spurious reports
16 07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
17 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
18
19***********************************************************************/
20
21#define INCL_DOS
22#define INCL_WIN
23#define INCL_LONGLONG // dircnrs.h
24
25#include "fm3dll.h"
26#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
27#include "init.h" // Data declaration(s)
28#include "fm3dlg.h"
29#include "fm3str.h"
30#include "arccnrs.h" // ArcObjWndProc
31#include "errutil.h" // Win_Error
32#include "fortify.h"
33#include "misc.h" // GetTidForThread
34#include "collect.h" // CollectorObjWndProc
35#include "objwin.h"
36#include "treecnr.h" // TreeObjWndProc
37#include "strutil.h" // GetPString
38
39static PSZ pszSrcFile = __FILE__;
40
41static MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
42
43MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
44{
45 DIRCNRDATA *dcd;
46
47 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
48 if (dcd) {
49 switch (dcd->type) {
50 case DIR_FRAME:
51 return DirObjWndProc(hwnd, msg, mp1, mp2);
52 case TREE_FRAME:
53 return TreeObjWndProc(hwnd, msg, mp1, mp2);
54 case COLLECTOR_FRAME:
55 return CollectorObjWndProc(hwnd, msg, mp1, mp2);
56 case ARC_FRAME:
57 return ArcObjWndProc(hwnd, msg, mp1, mp2);
58 }
59 }
60 return WinDefWindowProc(hwnd, msg, mp1, mp2);
61}
62
63VOID MakeObjWin(VOID * args)
64{
65 HWND ObjectHwnd;
66 HAB hab2;
67 HMQ hmq2;
68 QMSG qmsg2;
69
70 hab2 = WinInitialize(0);
71 if (hab2) {
72 hmq2 = WinCreateMsgQueue(hab2, 512);
73 if (hmq2) {
74 DosError(FERR_DISABLEHARDERR);
75 WinRegisterClass(hab2,
76 (CHAR *) WC_OBJECTWINDOW,
77 ObjectWndProc, 0, sizeof(PVOID));
78 ObjectHwnd = WinCreateWindow(HWND_OBJECT,
79 (CHAR *) WC_OBJECTWINDOW,
80 (PSZ) NULL,
81 0,
82 0L,
83 0L,
84 0L,
85 0L, 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
86 if (!ObjectHwnd)
87 Win_Error(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
88 PCSZ_WINCREATEWINDOW);
89 else {
90# ifdef FORTIFY
91 Fortify_EnterScope();
92# endif
93 WinSetWindowPtr(ObjectHwnd, QWL_USER, args);
94 // initially populate container
95 // 18 Jul 08 SHL fixme to know if this really kills WM_CREATE
96 WinSendMsg(ObjectHwnd, UM_SETUP, MPVOID, MPVOID);
97 PostMsg(ObjectHwnd, UM_RESCAN, MPVOID, MPVOID);
98 priority_normal();
99 while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))
100 WinDispatchMsg(hab2, &qmsg2);
101 WinDestroyWindow(ObjectHwnd);
102# ifdef FORTIFY
103 {
104 // Allow container to close and free data
105 HWND hwndCnr = ((DIRCNRDATA *)args)->hwndCnr;
106 USHORT i;
107 for (i = 0; WinIsWindow(hab2, hwndCnr) && i < 10; i++)
108 DosSleep(50);
109 for (;;) {
110 UCHAR scope = Fortify_LeaveScope();
111 if ((CHAR)scope == 0)
112 break;
113 Runtime_Error(pszSrcFile, __LINE__, "Attempting to exit thread %u with scope non-zero (%u)",
114 GetTidForThread(), scope);
115 if ((CHAR)scope < 0)
116 break;
117 }
118 }
119# endif
120 }
121 WinDestroyMsgQueue(hmq2);
122 }
123 WinTerminate(hab2);
124 }
125}
126
127#pragma alloc_text(OBJWIN,ObjectWndProc,MakeObjWin)
Note: See TracBrowser for help on using the repository browser.