source: trunk/dll/objwin.c@ 1395

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

Allow user to turn off alert and/or error beeps in settings notebook. Ticket 341 Move repeated strings to PCSZs. Ticket 6 Add *DateFormat functions to format dates based on locale Ticket 28 Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error Ticket 6

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