{"id":5225,"date":"2014-03-30T19:56:23","date_gmt":"2014-03-30T19:56:23","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/do-you-have-to-register-a-dialog-box-collection-of-common-programming-errors\/"},"modified":"2014-03-30T19:56:23","modified_gmt":"2014-03-30T19:56:23","slug":"do-you-have-to-register-a-dialog-box-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/do-you-have-to-register-a-dialog-box-collection-of-common-programming-errors\/","title":{"rendered":"Do you have to register a Dialog Box?-Collection of common programming errors"},"content":{"rendered":"<p>So, I am a total beginner in any kind of Windows related programming. I have been playing around with the Windows API and came across a couple of examples on how to initialize create windows and such.<\/p>\n<p>One example creates a regular window (I abbreviated some of the code):<\/p>\n<pre>\n    int WINAPI WinMain( [...] )\n    {\n\n    [...]\n\n    \/\/ Windows Class setup\n    wndClass.cbSize = sizeof( wndClass );\n    wndClass.style  = CS_HREDRAW | CS_VREDRAW;\n    [...]    \n\n    \/\/ Register class\n    RegisterClassEx( &amp;wndClass );\n\n    \/\/ Create window\n    hWnd = CreateWindow( szAppName, \"Win32 App\",\n                         WS_OVERLAPPEDWINDOW,\n                         0, 0, 512, 384,\n                         NULL, NULL, hInstance, NULL );\n    [...]\n    }\n<\/pre>\n<p>The second example creates a dialog box (no abbreviations except the WinMain arguments):<\/p>\n<pre>\n    int WINAPI WinMain( [...] )\n    {\n      \/\/ Create dialog box\n      DialogBox(hInstance, \n                MAKEINTRESOURCE(IDD_MAIN_DLG), \n                NULL, \n                (DLGPROC)DialogProc);\n    }\n<\/pre>\n<p>The second example does not contain any call to the register function. It just creates the DialogBox with its DialogProc process attached.<\/p>\n<p>This works fine, but I am wondering if there is a benefit of registering the window class and then creating the dialog box (if this is at all possible).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, I am a total beginner in any kind of Windows related programming. I have been playing around with the Windows API and came across a couple of examples on how to initialize create windows and such. One example creates a regular window (I abbreviated some of the code): int WINAPI WinMain( [&#8230;] ) { [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5225","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5225"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5225\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}