0024275: Cppcheck warnings on uninitialized class members
[occt.git] / src / Draw / init.cxx
CommitLineData
b311480e 1// Created on: 1998-08-06
2// Created by: Administrateur Atelier MDL
3// Copyright (c) 1998-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23#ifdef WNT
24
25// include windows.h first to have all definitions available
26#include <windows.h>
27
28#include "Draw_Window.hxx"
29#include "DrawRessource.h"
30#include "init.h"
31#include "MainWindow.h"
32#include "CommandWindow.h"
33
34
35#define USEDEFAULT 200
36
37
38/*--------------------------------------------------------*\
39| REGISTER APPLICATION CLASS
40| Enregistrement des classes de fenetres de l'application
41|
42d\*--------------------------------------------------------*/
43
44BOOL RegisterAppClass(HINSTANCE hInstance)
45{
46 WNDCLASS wndClass;
47
48 // Parametres communs aux classes
49 //-----
50 wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_CLASSDC;
51 wndClass.cbClsExtra = 0;
52 wndClass.hCursor = LoadCursor(NULL,IDC_ARROW);
53 wndClass.hInstance = hInstance;
54
55 // Enregistrement de la fenetre principale
56 //-----
57 wndClass.cbWndExtra = sizeof(LONG);
58 wndClass.lpfnWndProc = (WNDPROC)WndProc;
59 wndClass.hIcon = (HICON)LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
60 wndClass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
61 wndClass.lpszMenuName = MAKEINTRESOURCE(APPMENU);
62 wndClass.lpszClassName = APPCLASS;
63
64 if(!RegisterClass(&wndClass))
65 return(FALSE);
66
67 // Enregistrement de la fenetre DrawWindow
68 //------
69 wndClass.cbWndExtra = sizeof(LONG); // Extra Memory
70 wndClass.lpfnWndProc = (WNDPROC)DrawWindow::DrawProc;
71 wndClass.hIcon = 0;
72 wndClass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
73 wndClass.lpszMenuName = NULL;
74 wndClass.lpszClassName = DRAWCLASS;
75
76 if(!RegisterClass(&wndClass))
77 {
78 UnregisterClass(APPCLASS, hInstance);
79 return(FALSE);
80 }
81
82
83 // Enregistrement de la fenetre CommandWindow
84 //------
85 wndClass.lpfnWndProc = (WNDPROC)CommandProc((HWND)WndProc,(WPARAM)342,(LPARAM)443);
86 //wndClass.lpfnWndProc = (WNDPROC)CommandProc;
87 wndClass.hIcon = 0;
88 wndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
89 wndClass.lpszMenuName = NULL;
90 wndClass.lpszClassName = COMMANDCLASS;
91
92 if(!RegisterClass(&wndClass))
93 {
94 UnregisterClass(APPCLASS, hInstance);
95 UnregisterClass(DRAWCLASS, hInstance);
96 return(FALSE);
97 }
98
99 return(TRUE);
100}
101
102
103/*--------------------------------------------------------*\
104| UNREGISTER APPLICATION CLASS
105| Suppression des classes de fenetres de l'application
106|
107\*--------------------------------------------------------*/
108VOID UnregisterAppClass(HINSTANCE hInstance)
109{
110 UnregisterClass(APPCLASS, hInstance);
111 UnregisterClass(DRAWCLASS, hInstance);
112}
113
114
115/*--------------------------------------------------------*\
116| CREATE APPLICATION WINDOW
117| Creation de la fenetre Top-Level
118|
119\*--------------------------------------------------------*/
120HWND CreateAppWindow(HINSTANCE hInstance)
121{
122 return(CreateWindow(APPCLASS, APPTITLE,
123 WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
124 400,0,
125 623,767,
126 NULL, NULL, hInstance, NULL));
127}
128
129
130/*--------------------------------------------------------*\
131| CREATE MDI CLIENT WINDOW
132| Creation de la fenetre qui contient des fenetres MDI
133|
134\*--------------------------------------------------------*/
135HWND CreateMDIClientWindow(HWND hWndFrame)
136{
137 HWND hWndClient;
138 HANDLE hInstance;
139 CLIENTCREATESTRUCT ccs;
140
141 // Initialisation de la structure client
142 ccs.hWindowMenu = NULL;
143 ccs.idFirstChild = 0;
144
145#ifndef _WIN64
146 hInstance = (HANDLE)GetWindowLong(hWndFrame, GWL_HINSTANCE);
147#else
148 hInstance = (HANDLE)GetWindowLong(hWndFrame, GWLP_HINSTANCE);
149#endif
150
151 hWndClient = CreateWindow("MDICLIENT",NULL,
152 WS_CHILD | WS_CLIPSIBLINGS |
153 WS_VISIBLE | MDIS_ALLCHILDSTYLES,
154 0, 0, 1, 1,
155 hWndFrame, NULL,
156 (HINSTANCE)hInstance, (LPVOID)&ccs);
157 return(hWndClient);
158}
159#endif