1 // Created on: 1998-08-06
2 // Created by: Administrateur Atelier MDL
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
19 // include windows.h first to have all definitions available
22 #include "Draw_Window.hxx"
23 #include "DrawRessource.h"
25 #include "MainWindow.h"
26 #include "CommandWindow.h"
29 #define USEDEFAULT 200
32 /*--------------------------------------------------------*\
33 | REGISTER APPLICATION CLASS
34 | Enregistrement des classes de fenetres de l'application
36 d\*--------------------------------------------------------*/
38 BOOL RegisterAppClass(HINSTANCE hInstance)
42 // Parametres communs aux classes
44 wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_CLASSDC;
45 wndClass.cbClsExtra = 0;
46 wndClass.hCursor = LoadCursor (NULL, IDC_ARROW);
47 wndClass.hInstance = hInstance;
49 // Enregistrement de la fenetre principale
51 wndClass.cbWndExtra = sizeof(void*);
52 wndClass.lpfnWndProc = (WNDPROC)WndProc;
53 wndClass.hIcon = LoadIconW (hInstance, MAKEINTRESOURCEW(IDI_ICON1));
54 wndClass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
55 wndClass.lpszMenuName = MAKEINTRESOURCEW(APPMENU);
56 wndClass.lpszClassName = APPCLASS;
58 if(!RegisterClassW(&wndClass))
61 // Enregistrement de la fenetre DrawWindow
63 wndClass.cbWndExtra = sizeof(void*); // Extra Memory
64 wndClass.lpfnWndProc = (WNDPROC)DrawWindow::DrawProc;
66 wndClass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
67 wndClass.lpszMenuName = NULL;
68 wndClass.lpszClassName = DRAWCLASS;
70 if(!RegisterClassW(&wndClass))
72 UnregisterClassW(APPCLASS, hInstance);
77 // Enregistrement de la fenetre CommandWindow
79 wndClass.lpfnWndProc = (WNDPROC)CommandProc;
81 wndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
82 wndClass.lpszMenuName = NULL;
83 wndClass.lpszClassName = COMMANDCLASS;
85 if(!RegisterClassW(&wndClass))
87 UnregisterClassW(APPCLASS, hInstance);
88 UnregisterClassW(DRAWCLASS, hInstance);
96 /*--------------------------------------------------------*\
97 | UNREGISTER APPLICATION CLASS
98 | Suppression des classes de fenetres de l'application
100 \*--------------------------------------------------------*/
101 VOID UnregisterAppClass(HINSTANCE hInstance)
103 UnregisterClassW(APPCLASS, hInstance);
104 UnregisterClassW(DRAWCLASS, hInstance);
108 /*--------------------------------------------------------*\
109 | CREATE APPLICATION WINDOW
110 | Creation de la fenetre Top-Level
112 \*--------------------------------------------------------*/
113 HWND CreateAppWindow(HINSTANCE hInstance)
115 return(CreateWindowW(APPCLASS, APPTITLE,
116 WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
119 NULL, NULL, hInstance, NULL));
123 /*--------------------------------------------------------*\
124 | CREATE MDI CLIENT WINDOW
125 | Creation de la fenetre qui contient des fenetres MDI
127 \*--------------------------------------------------------*/
128 HWND CreateMDIClientWindow(HWND hWndFrame)
132 CLIENTCREATESTRUCT ccs;
134 // Initialisation de la structure client
135 ccs.hWindowMenu = NULL;
136 ccs.idFirstChild = 0;
138 hInstance = (HANDLE)GetWindowLongPtrW(hWndFrame, GWLP_HINSTANCE);
140 hWndClient = CreateWindowW(L"MDICLIENT",NULL,
141 WS_CHILD | WS_CLIPSIBLINGS |
142 WS_VISIBLE | MDIS_ALLCHILDSTYLES,
145 (HINSTANCE)hInstance, (LPVOID)&ccs);