Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
hw3d
Commits
416d3cdb
Commit
416d3cdb
authored
Dec 17, 2018
by
chili
Browse files
set window title, fix FAILED
parent
9bde6218
Changes
2
Show whitespace changes
Inline
Side-by-side
hw3d/Window.cpp
View file @
416d3cdb
...
@@ -76,10 +76,10 @@ Window::Window( int width,int height,const char* name )
...
@@ -76,10 +76,10 @@ Window::Window( int width,int height,const char* name )
wr
.
right
=
width
+
wr
.
left
;
wr
.
right
=
width
+
wr
.
left
;
wr
.
top
=
100
;
wr
.
top
=
100
;
wr
.
bottom
=
height
+
wr
.
top
;
wr
.
bottom
=
height
+
wr
.
top
;
if
(
FAILED
(
AdjustWindowRect
(
&
wr
,
WS_CAPTION
|
WS_MINIMIZEBOX
|
WS_SYSMENU
,
FALSE
)
)
)
if
(
AdjustWindowRect
(
&
wr
,
WS_CAPTION
|
WS_MINIMIZEBOX
|
WS_SYSMENU
,
FALSE
)
==
0
)
{
{
throw
CHWND_LAST_EXCEPT
();
throw
CHWND_LAST_EXCEPT
();
}
;
}
// create window & get hWnd
// create window & get hWnd
hWnd
=
CreateWindow
(
hWnd
=
CreateWindow
(
WindowClass
::
GetName
(),
name
,
WindowClass
::
GetName
(),
name
,
...
@@ -101,6 +101,14 @@ Window::~Window()
...
@@ -101,6 +101,14 @@ Window::~Window()
DestroyWindow
(
hWnd
);
DestroyWindow
(
hWnd
);
}
}
void
Window
::
SetTitle
(
const
std
::
string
&
title
)
{
if
(
SetWindowText
(
hWnd
,
title
.
c_str
()
)
==
0
)
{
throw
CHWND_LAST_EXCEPT
();
}
}
LRESULT
CALLBACK
Window
::
HandleMsgSetup
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
noexcept
LRESULT
CALLBACK
Window
::
HandleMsgSetup
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
noexcept
{
{
// use create parameter passed in from CreateWindow() to store window class pointer at WinAPI side
// use create parameter passed in from CreateWindow() to store window class pointer at WinAPI side
...
...
hw3d/Window.h
View file @
416d3cdb
...
@@ -60,6 +60,7 @@ public:
...
@@ -60,6 +60,7 @@ public:
~
Window
();
~
Window
();
Window
(
const
Window
&
)
=
delete
;
Window
(
const
Window
&
)
=
delete
;
Window
&
operator
=
(
const
Window
&
)
=
delete
;
Window
&
operator
=
(
const
Window
&
)
=
delete
;
void
SetTitle
(
const
std
::
string
&
title
);
private:
private:
static
LRESULT
CALLBACK
HandleMsgSetup
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
noexcept
;
static
LRESULT
CALLBACK
HandleMsgSetup
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
noexcept
;
static
LRESULT
CALLBACK
HandleMsgThunk
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
noexcept
;
static
LRESULT
CALLBACK
HandleMsgThunk
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
noexcept
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment