source: trunk/dll/objwin.c@ 1673

Last change on this file since 1673 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
RevLine 
[377]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
[1498]9 Copyright (c) 2006, 2010 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
[1395]16 07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
[1498]17 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
[377]18
19***********************************************************************/
20
[2]21#define INCL_DOS
22#define INCL_WIN
[907]23#define INCL_LONGLONG // dircnrs.h
[2]24
[1173]25#include "fm3dll.h"
[1226]26#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
[1211]27#include "init.h" // Data declaration(s)
[2]28#include "fm3dlg.h"
29#include "fm3str.h"
[907]30#include "arccnrs.h" // ArcObjWndProc
31#include "errutil.h" // Win_Error
[1078]32#include "fortify.h"
33#include "misc.h" // GetTidForThread
[1156]34#include "collect.h" // CollectorObjWndProc
35#include "objwin.h"
36#include "treecnr.h" // TreeObjWndProc
[1395]37#include "strutil.h" // GetPString
[2]38
[377]39static PSZ pszSrcFile = __FILE__;
40
[1156]41static MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
42
[551]43MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
[413]44{
[2]45 DIRCNRDATA *dcd;
46
[551]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);
[2]58 }
59 }
[551]60 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]61}
62
[551]63VOID MakeObjWin(VOID * args)
[413]64{
[551]65 HWND ObjectHwnd;
66 HAB hab2;
67 HMQ hmq2;
68 QMSG qmsg2;
[2]69
70 hab2 = WinInitialize(0);
[551]71 if (hab2) {
72 hmq2 = WinCreateMsgQueue(hab2, 512);
73 if (hmq2) {
[2]74 DosError(FERR_DISABLEHARDERR);
75 WinRegisterClass(hab2,
[1498]76 (CHAR *) WC_OBJECTWINDOW,
[551]77 ObjectWndProc, 0, sizeof(PVOID));
[2]78 ObjectHwnd = WinCreateWindow(HWND_OBJECT,
[1498]79 (CHAR *) WC_OBJECTWINDOW,
[551]80 (PSZ) NULL,
81 0,
82 0L,
83 0L,
84 0L,
85 0L, 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
[377]86 if (!ObjectHwnd)
[1395]87 Win_Error(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
88 PCSZ_WINCREATEWINDOW);
[377]89 else {
[1077]90# ifdef FORTIFY
91 Fortify_EnterScope();
92# endif
[551]93 WinSetWindowPtr(ObjectHwnd, QWL_USER, args);
[1673]94 // initially populate container
[1077]95 // 18 Jul 08 SHL fixme to know if this really kills WM_CREATE
[551]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);
[1077]102# ifdef FORTIFY
[1062]103 {
[1077]104 // Allow container to close and free data
[1062]105 HWND hwndCnr = ((DIRCNRDATA *)args)->hwndCnr;
106 USHORT i;
[1077]107 for (i = 0; WinIsWindow(hab2, hwndCnr) && i < 10; i++)
108 DosSleep(50);
[1078]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 }
[1062]118 }
[1077]119# endif
[2]120 }
121 WinDestroyMsgQueue(hmq2);
122 }
123 WinTerminate(hab2);
124 }
125}
[793]126
127#pragma alloc_text(OBJWIN,ObjectWndProc,MakeObjWin)
Note: See TracBrowser for help on using the repository browser.