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
1f0a4498
Commit
1f0a4498
authored
Dec 04, 2018
by
chili
Browse files
baby's first wndproc
parent
8a97ca31
Changes
1
Hide whitespace changes
Inline
Side-by-side
hw3d/WinMain.cpp
View file @
1f0a4498
#include <Windows.h>
#include <Windows.h>
LRESULT
CALLBACK
WndProc
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
switch
(
msg
)
{
case
WM_CLOSE
:
PostQuitMessage
(
69
);
break
;
}
return
DefWindowProc
(
hWnd
,
msg
,
wParam
,
lParam
);
}
int
CALLBACK
WinMain
(
int
CALLBACK
WinMain
(
HINSTANCE
hInstance
,
HINSTANCE
hInstance
,
HINSTANCE
hPrevInstance
,
HINSTANCE
hPrevInstance
,
...
@@ -11,7 +23,7 @@ int CALLBACK WinMain(
...
@@ -11,7 +23,7 @@ int CALLBACK WinMain(
WNDCLASSEX
wc
=
{
0
};
WNDCLASSEX
wc
=
{
0
};
wc
.
cbSize
=
sizeof
(
wc
);
wc
.
cbSize
=
sizeof
(
wc
);
wc
.
style
=
CS_OWNDC
;
wc
.
style
=
CS_OWNDC
;
wc
.
lpfnWndProc
=
DefWindow
Proc
;
wc
.
lpfnWndProc
=
Wnd
Proc
;
wc
.
cbClsExtra
=
0
;
wc
.
cbClsExtra
=
0
;
wc
.
cbWndExtra
=
0
;
wc
.
cbWndExtra
=
0
;
wc
.
hInstance
=
hInstance
;
wc
.
hInstance
=
hInstance
;
...
@@ -35,11 +47,19 @@ int CALLBACK WinMain(
...
@@ -35,11 +47,19 @@ int CALLBACK WinMain(
// message pump
// message pump
MSG
msg
;
MSG
msg
;
while
(
GetMessage
(
&
msg
,
nullptr
,
0
,
0
)
>
0
)
BOOL
gResult
;
while
(
(
gResult
=
GetMessage
(
&
msg
,
nullptr
,
0
,
0
))
>
0
)
{
{
TranslateMessage
(
&
msg
);
TranslateMessage
(
&
msg
);
DispatchMessage
(
&
msg
);
DispatchMessage
(
&
msg
);
}
}
return
0
;
if
(
gResult
==
-
1
)
{
return
-
1
;
}
else
{
return
msg
.
wParam
;
}
}
}
\ No newline at end of file
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