{"id":93781,"date":"2015-12-09T20:53:45","date_gmt":"2015-12-09T16:53:45","guid":{"rendered":"http:\/\/blagovest.org.ru\/?p=93781"},"modified":"2015-12-09T20:53:45","modified_gmt":"2015-12-09T16:53:45","slug":"c-winapi-legkij-vopros","status":"publish","type":"post","link":"https:\/\/blagovest.org.ru\/?p=93781","title":{"rendered":"C++ winapi \u043b\u0435\u0433\u043a\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441"},"content":{"rendered":"<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u0430\u043a\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443:<br \/>#include&lt;windows.h&gt;<br \/>LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);<br \/>char szClassName[]=&quot;Windows Example&quot;;<br \/>HINSTANCE hint;<br \/>int WINAPI WinMain(HINSTANCE hint, HINSTANCE prevhint,LPSTR lpszArgument, int nFunsterStil) {<br \/> &nbsp; &nbsp;HWND hwnd;<br \/> &nbsp; &nbsp;MSG messages;<br \/> &nbsp; &nbsp;WNDCLASSEX wnd;<br \/> &nbsp; &nbsp;wnd.hInstance = hint;<br \/> &nbsp; &nbsp;wnd.lpfnWndProc = WindowProcedure;<br \/> &nbsp; &nbsp;wnd.lpszClassName = szClassName;<br \/> &nbsp; &nbsp;wnd.style = CS_DBLCLKS;<br \/> &nbsp; &nbsp;wnd.cbSize = sizeof(WNDCLASSEX);<br \/> &nbsp; &nbsp;\/\/wnd.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);<br \/> &nbsp; &nbsp;if(!RegisterClassEx(&amp;wnd)) return 0;<br \/> &nbsp; &nbsp;hwnd = CreateWindowEx(0, szClassName, &quot;Windows test&quot;,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,HWND_DESKTOP,NULL,hint,NULL);<br \/> &nbsp; &nbsp;ShowWindow(hwnd,nFunsterStil);<br \/> &nbsp; &nbsp;while(GetMessage(&amp;messages, NULL, 0, 0))<br \/> &nbsp; &nbsp;{<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/* Send message to WindowProcedure *\/<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DispatchMessage(&amp;messages);<br \/> &nbsp; &nbsp;}<\/p>\n<p> &nbsp; &nbsp;\/* The program returvalue is 0 &#8212; The value that PostQuitMessage( ) gave *\/<br \/> &nbsp; &nbsp;return messages.wParam;<br \/>}<br \/>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u043d\u043e \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f.<br \/>\u0412\u043e\u0442 \u0447\u0442\u043e \u043f\u0438\u0448\u0435\u0442 \u043f\u0440\u043e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043e\u043a\u043d\u0430: &nbsp;[Linker error] undefined reference to `_Z15WindowProcedureP6HWND__jjl@16&#8242; <br \/> &nbsp;ld returned 1 exit status <br \/>\u0412\u0438\u0434\u0438\u043c\u043e \u043a\u0430\u043a-\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u043b?&nbsp;&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u0430\u043a\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443:#include&lt;windows.h&gt;LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);char szClassName[]=&quot;Windows Example&quot;;HINSTANCE hint;int WINAPI WinMain(HINSTANCE hint, HINSTANCE prevhint,LPSTR lpszArgument, int nFunsterStil) { &nbsp; &nbsp;HWND hwnd; &nbsp; &nbsp;MSG messages; &nbsp; &nbsp;WNDCLASSEX wnd; &nbsp; &nbsp;wnd.hInstance = hint; &nbsp; &nbsp;wnd.lpfnWndProc = WindowProcedure; &nbsp; &nbsp;wnd.lpszClassName = szClassName; &nbsp; &nbsp;wnd.style = CS_DBLCLKS; &nbsp; &nbsp;wnd.cbSize = sizeof(WNDCLASSEX); &nbsp; &nbsp;\/\/wnd.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH); &nbsp; &nbsp;if(!RegisterClassEx(&amp;wnd)) return [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1435],"tags":[779,1561,189,1460],"class_list":["post-93781","post","type-post","status-publish","format-standard","hentry","category-windows","tag-c-2","tag-winapi","tag-bazy-dannyh","tag-programmirovanie"],"_links":{"self":[{"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=\/wp\/v2\/posts\/93781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=93781"}],"version-history":[{"count":0,"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=\/wp\/v2\/posts\/93781\/revisions"}],"wp:attachment":[{"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=93781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=93781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=93781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}