Created
March 14, 2013 03:39
-
-
Save bombless/5158630 to your computer and use it in GitHub Desktop.
C99的复合常量(Compound Literals)真是太棒了!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
** [email protected] | |
** 2013-3-14 | |
** 关于复合常量可参考[http://www.waikinq.com/the-c99s-new-characteristics/] | |
**/ | |
#define UNICODE | |
#include <windows.h> | |
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ | |
switch(uMsg){ | |
case WM_DESTROY: | |
PostQuitMessage(0); | |
return 0; | |
} | |
return DefWindowProc(hWnd, uMsg, wParam, lParam); | |
} | |
int main(){ | |
RegisterClass( | |
&((WNDCLASS){ | |
.style = CS_HREDRAW | CS_VREDRAW, | |
.hIcon = LoadIcon(NULL, IDI_APPLICATION), | |
.hCursor = LoadCursor(NULL, IDC_ARROW), | |
.lpszClassName = L"WINDOW_CLASS", | |
.lpfnWndProc = WndProc})); | |
HWND hWnd = CreateWindowEx(0, L"WINDOW_CLASS", L"C99太棒了", WS_OVERLAPPEDWINDOW, | |
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, GetModuleHandle(0), NULL); | |
ShowWindow(hWnd, TRUE); | |
UpdateWindow(hWnd); | |
MSG msg; | |
while(GetMessage(&msg, NULL, 0, 0)){ | |
TranslateMessage(&msg); | |
DispatchMessage(&msg); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment