source: trunk/dll/objwin.c@ 1178

Last change on this file since 1178 was 1178, checked in by John Small, 17 years ago

Ticket 187: Draft 2: Move remaining function declarations

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