source: trunk/dll/objwin.c@ 1063

Last change on this file since 1063 was 1063, checked in by Gregg Young, 17 years ago

Fortify ifdef reformat

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1
2/***********************************************************************
3
4 $Id: objwin.c 1063 2008-07-11 03:33:36Z gyoung $
5
6 Object windows
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2006, 2008 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
17***********************************************************************/
18
19#define INCL_DOS
20#define INCL_WIN
21#define INCL_LONGLONG // dircnrs.h
22
23#include "fm3dlg.h"
24#include "fm3str.h"
25#include "arccnrs.h" // ArcObjWndProc
26#include "errutil.h" // Win_Error
27#include "fm3dll.h"
28#include "fortify.h"
29
30static PSZ pszSrcFile = __FILE__;
31
32MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
33{
34 DIRCNRDATA *dcd;
35
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);
47 }
48 }
49 return WinDefWindowProc(hwnd, msg, mp1, mp2);
50}
51
52VOID MakeObjWin(VOID * args)
53{
54 HWND ObjectHwnd;
55 HAB hab2;
56 HMQ hmq2;
57 QMSG qmsg2;
58
59 hab2 = WinInitialize(0);
60 if (hab2) {
61 hmq2 = WinCreateMsgQueue(hab2, 512);
62 if (hmq2) {
63 DosError(FERR_DISABLEHARDERR);
64 WinRegisterClass(hab2,
65 WC_OBJECTWINDOW,
66 ObjectWndProc, 0, sizeof(PVOID));
67 ObjectHwnd = WinCreateWindow(HWND_OBJECT,
68 WC_OBJECTWINDOW,
69 (PSZ) NULL,
70 0,
71 0L,
72 0L,
73 0L,
74 0L, 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
75 if (!ObjectHwnd)
76 Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
77 IDS_WINCREATEWINDOW);
78 else {
79# ifdef FORTIFY
80 Fortify_EnterScope();
81# endif
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);
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
101 }
102 WinDestroyMsgQueue(hmq2);
103 }
104 WinTerminate(hab2);
105 }
106}
107
108#pragma alloc_text(OBJWIN,ObjectWndProc,MakeObjWin)
Note: See TracBrowser for help on using the repository browser.