{"id":202,"date":"2014-06-09T18:35:19","date_gmt":"2014-06-09T09:35:19","guid":{"rendered":"http:\/\/csharp.ihavenomoney.co.kr\/?p=202"},"modified":"2019-06-27T10:39:47","modified_gmt":"2019-06-27T01:39:47","slug":"%ec%88%9c%ec%88%98c-%eb%a7%8c-%ec%82%ac%ec%9a%a9-window","status":"publish","type":"post","link":"https:\/\/csharp.ihavenomoney.co.kr\/?p=202","title":{"rendered":"\uc21c\uc218C \ub9cc \uc0ac\uc6a9 Window"},"content":{"rendered":"<p><a href=\"http:\/\/csharp.ihavenomoney.co.kr\/wp-content\/uploads\/2014\/06\/classwindow.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/csharp.ihavenomoney.co.kr\/wp-content\/uploads\/2014\/06\/classwindow-300x236.png\" alt=\"classwindow\" width=\"300\" height=\"236\" class=\"alignnone size-medium wp-image-197\" srcset=\"https:\/\/csharp.ihavenomoney.co.kr\/wp-content\/uploads\/2014\/06\/classwindow-300x236.png 300w, https:\/\/csharp.ihavenomoney.co.kr\/wp-content\/uploads\/2014\/06\/classwindow.png 319w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<pre class=\"lang:c++ decode:true \" >#include &lt;Windows.h&gt;\r\n\r\nLRESULT CALLBACK WndProc(HWND hwnd,UINT iMsg,WPARAM wParam,LPARAM lParam)\r\n{\r\n    HDC hdc;\r\n\tPAINTSTRUCT ps;\r\n\tRECT rect;\r\n\r\n\tswitch(iMsg){\r\n\tcase WM_CREATE:\r\n\t\treturn 0;\r\n\tcase WM_PAINT:\r\n\t\thdc=BeginPaint(hwnd,&amp;ps);\r\n\t\tGetClientRect(hwnd,&amp;rect);\r\n\t\tDrawText(hdc,\"Hello Window\",-1,&amp;rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER);\r\n\t\tEndPaint(hwnd,&amp;ps);\r\n\t\treturn 0;\r\n\tcase WM_DESTROY:\r\n\t\tPostQuitMessage(0);\r\n\t\treturn 0;\r\n\t}\r\n\treturn DefWindowProc(hwnd,iMsg,wParam,lParam);\r\n}\r\n\r\nint WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,PSTR szCmdLine,int iCmdShow)\r\n{\r\n\tstatic char szAppName[]=\"Hello Win\";\r\n\tHWND hwnd;\r\n\tMSG msg;\r\n\tWNDCLASSEX wndclass;\r\n\r\nwndclass.cbSize = sizeof(wndclass);\r\n\twndclass.style  = CS_HREDRAW|CS_VREDRAW;\r\n\twndclass.lpfnWndProc = WndProc;\r\n\twndclass.cbClsExtra =0;\r\n\twndclass.cbWndExtra= 0;\r\n\twndclass.hInstance = hInstance;\r\n\twndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);\r\n\twndclass.hCursor = LoadCursor(NULL,IDC_ARROW);\r\n\twndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);\r\n\twndclass.lpszMenuName = NULL;\r\n\twndclass.lpszClassName = szAppName;\r\n\twndclass.hIconSm = LoadIcon(NULL,IDI_APPLICATION);\r\n\r\n\tRegisterClassEx(&amp;wndclass);\r\n\r\n\thwnd = CreateWindow(szAppName,\r\n\t\t\t\t\t\t\"Hello Program\",\r\n\t\t\t\t\t\tWS_OVERLAPPEDWINDOW,\r\n\t\t\t\t\t\tCW_USEDEFAULT,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tCW_USEDEFAULT,\r\n\t\t\t\t\t\t0,\r\n\t\t\t\t\t\tNULL,\r\n\t\t\t\t\t\tNULL,\r\n\t\t\t\t\t\thInstance,\r\n\t\t\t\t\t\tNULL);\r\n\tShowWindow(hwnd,iCmdShow);\r\n\t\/\/UpdateWindow(hwnd);\r\n\twhile(GetMessage(&amp;msg,NULL,0,0)){\r\n\t\t\/\/TranslateMessage(&amp;msg);\r\n\t\tstatic int i=0;\r\n\t\tchar buffer[80];\r\n\t\twsprintf(buffer,\"i\\n\",++i);\r\n\t\tOutputDebugString(buffer);\r\n\t\tDispatchMessage(&amp;msg);\r\n\t}\r\n\twhile(1)\r\n\t{\r\n\t\tif(PeekMessage(&amp;msg,NULL,0,0,PM_REMOVE))\r\n\t\t{\r\n\t\t\tif(msg.message == WM_QUIT) break;\r\n\t\t\tDispatchMessage(&amp;msg);\r\n\t\t}\r\n\t\tstatic int i =0;\r\n\t\tchar buffer[8];\r\n\t\twsprintf(buffer,\"i\\n\",++i);\r\n\t\tOutputDebugString(buffer);\r\n\t}\r\n\treturn msg.wParam;\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#include &lt;Windows.h&gt; LRESULT CALLBACK WndProc(HWND hwnd,UINT iMsg,WPARAM wParam,LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; RECT rect; switch(iMsg){ case WM_CREATE: return 0; case WM_PAINT: hdc=BeginPaint(hwnd,&amp;ps); GetClientRect(hwnd,&amp;rect); DrawText(hdc,&#8221;Hello Window&#8221;,-1,&amp;rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER); EndPaint(hwnd,&amp;ps); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hwnd,iMsg,wParam,lParam); } int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,PSTR szCmdLine,int iCmdShow) { static char szAppName[]=&#8221;Hello Win&#8221;; HWND hwnd; MSG msg;\u2026 <span class=\"read-more\"><a href=\"https:\/\/csharp.ihavenomoney.co.kr\/?p=202\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-202","post","type-post","status-publish","format-standard","hentry","category-c"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=202"}],"version-history":[{"count":2,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/202\/revisions"}],"predecessor-version":[{"id":537,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/202\/revisions\/537"}],"wp:attachment":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}