{"id":297,"date":"2009-05-12T23:35:28","date_gmt":"2009-05-12T18:05:28","guid":{"rendered":"http:\/\/techtwaddle.net\/?p=297"},"modified":"2011-04-12T23:35:58","modified_gmt":"2011-04-12T18:05:58","slug":"applications-creating-a-simple-ui-application-from-scratch-part-1","status":"publish","type":"post","link":"https:\/\/techtwaddle.co.in\/blog\/2009\/05\/12\/applications-creating-a-simple-ui-application-from-scratch-part-1\/","title":{"rendered":"Applications: Creating a simple UI application from scratch, Part 1"},"content":{"rendered":"<p>\n<link href=\"file:\/\/\/D:\\DOCUME~1\\PRABHU~1.PRA\\LOCALS~1\\Temp\\msohtmlclip1\\01\\clip_filelist.xml\" rel=\"File-List\" \/>\n<link href=\"file:\/\/\/D:\\DOCUME~1\\PRABHU~1.PRA\\LOCALS~1\\Temp\\msohtmlclip1\\01\\clip_themedata.thmx\" rel=\"themeData\" \/>\n<link href=\"file:\/\/\/D:\\DOCUME~1\\PRABHU~1.PRA\\LOCALS~1\\Temp\\msohtmlclip1\\01\\clip_colorschememapping.xml\" rel=\"colorSchemeMapping\" \/><!--[if gte mso 9]><xml>\n<w:LatentStyles DefLockedState=\"false\" DefUnhideWhenUsed=\"true\"\nDefSemiHidden=\"true\" DefQFormat=\"false\" DefPriority=\"99\"\nLatentStyleCount=\"267\">\n<w:LsdException Locked=\"false\" Priority=\"0\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"Normal\" \/>\n<w:LsdException Locked=\"false\" Priority=\"9\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"heading 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"9\" QFormat=\"true\" Name=\"heading 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"9\" QFormat=\"true\" Name=\"heading 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"9\" QFormat=\"true\" Name=\"heading 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"9\" QFormat=\"true\" Name=\"heading 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"9\" QFormat=\"true\" Name=\"heading 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"9\" QFormat=\"true\" Name=\"heading 7\" \/>\n<w:LsdException Locked=\"false\" Priority=\"9\" QFormat=\"true\" Name=\"heading 8\" \/>\n<w:LsdException Locked=\"false\" Priority=\"9\" QFormat=\"true\" Name=\"heading 9\" \/>\n<w:LsdException Locked=\"false\" Priority=\"39\" Name=\"toc 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"39\" Name=\"toc 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"39\" Name=\"toc 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"39\" Name=\"toc 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"39\" Name=\"toc 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"39\" Name=\"toc 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"39\" Name=\"toc 7\" \/>\n<w:LsdException Locked=\"false\" Priority=\"39\" Name=\"toc 8\" \/>\n<w:LsdException Locked=\"false\" Priority=\"39\" Name=\"toc 9\" \/>\n<w:LsdException Locked=\"false\" Priority=\"35\" QFormat=\"true\" Name=\"caption\" \/>\n<w:LsdException Locked=\"false\" Priority=\"10\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"Title\" \/>\n<w:LsdException Locked=\"false\" Priority=\"1\" Name=\"Default Paragraph Font\" \/>\n<w:LsdException Locked=\"false\" Priority=\"11\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"Subtitle\" \/>\n<w:LsdException Locked=\"false\" Priority=\"22\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"Strong\" \/>\n<w:LsdException Locked=\"false\" Priority=\"20\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"Emphasis\" \/>\n<w:LsdException Locked=\"false\" Priority=\"59\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Table Grid\" \/>\n<w:LsdException Locked=\"false\" UnhideWhenUsed=\"false\" Name=\"Placeholder Text\" \/>\n<w:LsdException Locked=\"false\" Priority=\"1\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"No Spacing\" \/>\n<w:LsdException Locked=\"false\" Priority=\"60\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Shading\" \/>\n<w:LsdException Locked=\"false\" Priority=\"61\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light List\" \/>\n<w:LsdException Locked=\"false\" Priority=\"62\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Grid\" \/>\n<w:LsdException Locked=\"false\" Priority=\"63\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"64\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"65\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"66\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"67\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"68\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"69\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"70\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Dark List\" \/>\n<w:LsdException Locked=\"false\" Priority=\"71\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Shading\" \/>\n<w:LsdException Locked=\"false\" Priority=\"72\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful List\" \/>\n<w:LsdException Locked=\"false\" Priority=\"73\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Grid\" \/>\n<w:LsdException Locked=\"false\" Priority=\"60\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Shading Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"61\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light List Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"62\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Grid Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"63\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 1 Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"64\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 2 Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"65\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 1 Accent 1\" \/>\n<w:LsdException Locked=\"false\" UnhideWhenUsed=\"false\" Name=\"Revision\" \/>\n<w:LsdException Locked=\"false\" Priority=\"34\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"List Paragraph\" \/>\n<w:LsdException Locked=\"false\" Priority=\"29\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"Quote\" \/>\n<w:LsdException Locked=\"false\" Priority=\"30\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"Intense Quote\" \/>\n<w:LsdException Locked=\"false\" Priority=\"66\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 2 Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"67\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 1 Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"68\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 2 Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"69\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 3 Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"70\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Dark List Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"71\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Shading Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"72\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful List Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"73\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Grid Accent 1\" \/>\n<w:LsdException Locked=\"false\" Priority=\"60\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Shading Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"61\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light List Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"62\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Grid Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"63\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 1 Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"64\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 2 Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"65\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 1 Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"66\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 2 Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"67\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 1 Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"68\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 2 Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"69\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 3 Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"70\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Dark List Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"71\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Shading Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"72\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful List Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"73\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Grid Accent 2\" \/>\n<w:LsdException Locked=\"false\" Priority=\"60\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Shading Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"61\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light List Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"62\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Grid Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"63\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 1 Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"64\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 2 Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"65\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 1 Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"66\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 2 Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"67\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 1 Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"68\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 2 Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"69\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 3 Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"70\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Dark List Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"71\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Shading Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"72\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful List Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"73\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Grid Accent 3\" \/>\n<w:LsdException Locked=\"false\" Priority=\"60\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Shading Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"61\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light List Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"62\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Grid Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"63\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 1 Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"64\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 2 Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"65\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 1 Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"66\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 2 Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"67\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 1 Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"68\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 2 Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"69\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 3 Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"70\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Dark List Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"71\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Shading Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"72\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful List Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"73\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Grid Accent 4\" \/>\n<w:LsdException Locked=\"false\" Priority=\"60\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Shading Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"61\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light List Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"62\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Grid Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"63\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 1 Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"64\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 2 Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"65\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 1 Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"66\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 2 Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"67\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 1 Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"68\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 2 Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"69\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 3 Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"70\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Dark List Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"71\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Shading Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"72\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful List Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"73\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Grid Accent 5\" \/>\n<w:LsdException Locked=\"false\" Priority=\"60\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Shading Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"61\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light List Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"62\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Light Grid Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"63\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 1 Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"64\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Shading 2 Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"65\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 1 Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"66\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium List 2 Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"67\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 1 Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"68\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 2 Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"69\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Medium Grid 3 Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"70\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Dark List Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"71\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Shading Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"72\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful List Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"73\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" Name=\"Colorful Grid Accent 6\" \/>\n<w:LsdException Locked=\"false\" Priority=\"19\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"Subtle Emphasis\" \/>\n<w:LsdException Locked=\"false\" Priority=\"21\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"Intense Emphasis\" \/>\n<w:LsdException Locked=\"false\" Priority=\"31\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"Subtle Reference\" \/>\n<w:LsdException Locked=\"false\" Priority=\"32\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"Intense Reference\" \/>\n<w:LsdException Locked=\"false\" Priority=\"33\" SemiHidden=\"false\"\nUnhideWhenUsed=\"false\" QFormat=\"true\" Name=\"Book Title\" \/>\n<w:LsdException Locked=\"false\" Priority=\"37\" Name=\"Bibliography\" \/>\n<w:LsdException Locked=\"false\" Priority=\"39\" QFormat=\"true\" Name=\"TOC Heading\" \/>\n<\/w:LatentStyles>\n<\/xml><![endif]--><\/p>\n<style type=\"text\/css\"><!--\n \/* Font Definitions *\/\n @font-face\n\t{font-family:Wingdings;\n\tpanose-1:5 0 0 0 0 0 0 0 0 0;\n\tmso-font-charset:2;\n\tmso-generic-font-family:auto;\n\tmso-font-pitch:variable;\n\tmso-font-signature:0 268435456 0 0 -2147483648 0;}\n@font-face\n\t{font-family:\"Cambria Math\";\n\tpanose-1:2 4 5 3 5 4 6 3 2 4;\n\tmso-font-charset:0;\n\tmso-generic-font-family:roman;\n\tmso-font-pitch:variable;\n\tmso-font-signature:-1610611985 1107304683 0 0 159 0;}\n@font-face\n\t{font-family:Calibri;\n\tpanose-1:2 15 5 2 2 2 4 3 2 4;\n\tmso-font-charset:0;\n\tmso-generic-font-family:swiss;\n\tmso-font-pitch:variable;\n\tmso-font-signature:-1610611985 1073750139 0 0 159 0;}\n \/* Style Definitions *\/\n p.MsoNormal, li.MsoNormal, div.MsoNormal\n\t{mso-style-unhide:no;\n\tmso-style-qformat:yes;\n\tmso-style-parent:\"\";\n\tmargin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:10.0pt;\n\tmargin-left:0in;\n\tline-height:115%;\n\tmso-pagination:widow-orphan;\n\tfont-size:11.0pt;\n\tfont-family:\"Calibri\",\"sans-serif\";\n\tmso-fareast-font-family:\"Times New Roman\";\n\tmso-bidi-font-family:\"Times New Roman\";}\n.MsoChpDefault\n\t{mso-style-type:export-only;\n\tmso-default-props:yes;\n\tfont-size:10.0pt;\n\tmso-ansi-font-size:10.0pt;\n\tmso-bidi-font-size:10.0pt;\n\tmso-ascii-font-family:Calibri;\n\tmso-hansi-font-family:Calibri;}\n@page Section1\n\t{size:8.5in 11.0in;\n\tmargin:1.0in 1.0in 1.0in 1.0in;\n\tmso-header-margin:.5in;\n\tmso-footer-margin:.5in;\n\tmso-paper-source:0;}\ndiv.Section1\n\t{page:Section1;}\n--><\/style>\n<p><!--[if gte mso 10]>\n\n\n<style>\n\/* Style Definitions *\/\ntable.MsoNormalTable\n{mso-style-name:\"Table Normal\";\nmso-tstyle-rowband-size:0;\nmso-tstyle-colband-size:0;\nmso-style-noshow:yes;\nmso-style-priority:99;\nmso-style-qformat:yes;\nmso-style-parent:\"\";\nmso-padding-alt:0in 5.4pt 0in 5.4pt;\nmso-para-margin:0in;\nmso-para-margin-bottom:.0001pt;\nmso-pagination:widow-orphan;\nfont-size:11.0pt;\nfont-family:\"Calibri\",\"sans-serif\";\nmso-ascii-font-family:Calibri;\nmso-ascii-theme-font:minor-latin;\nmso-fareast-font-family:\"Times New Roman\";\nmso-fareast-theme-font:minor-fareast;\nmso-hansi-font-family:Calibri;\nmso-hansi-theme-font:minor-latin;\nmso-bidi-font-family:\"Times New Roman\";\nmso-bidi-theme-font:minor-bidi;}\n<\/style>\n\n\n<![endif]--><\/p>\n<p style=\"text-align: justify; font-family: Comic Sans MS;\" class=\"MsoNormal\"><font size=\"2\">Lets create a simple UI application for Win Mob 6 professional device, from scratch. When you create the project using the wizard you can see that basic code is already there. The main function, the window procedure etc. And then there&rsquo;s stdafx. I never quite understood what they are there for, but I guess they must be important. But when I create the application from scratch, there will no stdafx&rsquo;s. Just a plain simple file with a UI that shows up.<\/font><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><font size=\"2\"><span style=\"font-family: Comic Sans MS;\">To start, create a new project for Win32 smart devices, (I have mentioned about this is my previous <a href=\"http:\/\/geekswithblogs.net\/TechTwaddle\/archive\/2009\/04\/15\/applications-creating-a-simple-ui-application-for-windows-mobile-6.aspx\">posts<\/a>). At the last screen of the wizard, check the &ldquo;<span style=\"font-family: Verdana;\">Empty Project<\/span>&rdquo; checkbox. It will be unchecked by default. When you click finish, you&rsquo;ll see that the project is empty! (-:<\/span><\/font><\/p>\n<p style=\"text-align: justify; font-family: Comic Sans MS;\" class=\"MsoNormal\"><font size=\"2\">Ok, so the first thing we do is add a cpp file to our sources directory.<span style=\"\">&nbsp; <\/span>Lets call it FromScratch.cpp.<span style=\"\">&nbsp; <\/span>Add the following code, just to test if things are alright:<\/font><\/p>\n<p style=\"margin-bottom: 0.0001pt; text-align: justify; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\">#include<\/span><span style=\"font-size: 10pt;\"> &lt;windows.h&gt;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; text-align: justify; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\">#include<\/span><span style=\"font-size: 10pt;\"> &lt;aygshell.h&gt;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; text-align: justify; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; text-align: justify; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\">int<\/span><span style=\"font-size: 10pt;\"> WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; text-align: justify; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>LPTSTR lpCmdLine, int nCmdShow)<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; text-align: justify; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\">{<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; text-align: justify; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>MessageBox(NULL, L&quot;Hi there..&quot;, L&quot;Info&quot;, MB_OK);<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; text-align: justify; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>return 0;<o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;;\"><span style=\"font-family: Verdana; color: rgb(0, 0, 128);\">}<\/span><o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"line-height: 115%;\"><font size=\"2\"><span style=\"font-family: Comic Sans MS;\">Hit compile and run. You should see a message box. <span style=\"font-family: Verdana;\">windows.h<\/span> is the standard header file and <span style=\"font-family: Verdana;\">aygshell<\/span> contains UI stuff.&nbsp; <span style=\"font-family: Verdana;\">WinMain <\/span>is the entry point of your application and takes in 4 parameters. The first, <span style=\"font-family: Verdana;\">hInst<\/span>, is the handle to the instance of your module. The second is the handle to the previous instance of this program if it is already running. This param is always passed as <span style=\"font-family: Verdana;\">NULL<\/span>, so don&rsquo;t bother. <span style=\"font-family: Verdana;\">lpCmdLine <\/span>is the command line arguments, if any and the last param, <span style=\"font-family: Verdana;\">nCmdShow<\/span>, determines how the window is to be shown. Most of the times I just ignore all the params except <span style=\"font-family: Verdana;\">hInst<\/span>.<\/span><\/font><o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"line-height: 115%;\"><font size=\"2\"><span style=\"font-family: Comic Sans MS;\">Lets now add some UI to it. First create the resource file, which will hold all our application&#8217;s resources. Right click on &ldquo;<span style=\"font-family: Verdana;\">Resource Files<\/span>&rdquo; and add a new item, name it FromScratch.rc. <span style=\"font-family: Verdana;\">resource.h<\/span> will also be created in your project. Double click the resource file and add a new dialog to the resource by using &ldquo;A<span style=\"font-family: Verdana;\">dd resource..<\/span>&rdquo;. Add a new dialog for pocket pc portrait. Change the dialog properties, I renamed the title to &ldquo;From Scratch&rdquo;, changed the caption of the default label and changed the ID of the dialog to <span style=\"font-family: Verdana;\">IDD_PPC_FROMSCRATCH<\/span>. My dialog now looks like this:<\/span><\/font><o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"line-height: 115%;\"><img decoding=\"async\" loading=\"lazy\" width=\"240\" height=\"319\" src=\"\/images\/geekswithblogs_net\/TechTwaddle\/FromScratch\/DialogOnly.JPG\" alt=\"\" \/><o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"line-height: 115%;\"><font size=\"2\"><o:p style=\"font-family: Comic Sans MS;\"><\/o:p><span style=\"font-family: Comic Sans MS;\">Lets add a menu bar to our application. The thing with menu bar is, you need to define the menubar in a separate text file (.rc2 file for e.g.) and then include this text file in the .rc file. This is a known bug. So add a new text file to the project, call it &ldquo;FromScratch.rc2&rdquo; and include it in the .rc file.<\/span><\/font><o:p> <br \/>\n<\/o:p><\/span><\/p>\n<p style=\"text-align: justify; font-family: Comic Sans MS;\" class=\"MsoNormal\"><font size=\"2\"><span style=\"line-height: 115%;\">This menu bar will have two entries, the left soft key as &ldquo;<span style=\"font-family: Verdana;\">Exit<\/span>&rdquo; and the right soft key as &ldquo;<span style=\"font-family: Verdana;\">Refresh<\/span>&rdquo;. I ll let you in on refresh later.<o:p><\/o:p><\/span><\/font><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"line-height: 115%;\"><font size=\"2\"><span style=\"font-family: Comic Sans MS;\">We need two string resources for &ldquo;<span style=\"font-family: Verdana;\">Exit<\/span>&rdquo; and &ldquo;<span style=\"font-family: Verdana;\">Refresh<\/span>&rdquo; and two codes which will be sent when the user clicks on them. Define the menubar in the .rc2 file:<\/span><\/font><o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\">IDR_MENU_FROMSCRATCH SHMENUBAR DISCARDABLE<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\">BEGIN<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp; <\/span>IDR_MENU_FROMSCRATCH, <o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp; <\/span>2,<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp; <\/span>I_IMAGENONE, IDM_EXIT, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE,<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp; <\/span>IDS_EXIT, 0, NOMENU,<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp; <\/span><o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp; <\/span>I_IMAGENONE, IDM_REFRESH, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE,<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; font-family: Verdana; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp; <\/span>IDS_REFRESH, 0, NOMENU,<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"font-family: Verdana;\">END<\/span><o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"line-height: 115%;\"><o:p>&nbsp;<br \/>\n<\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"line-height: 115%;\"><font size=\"2\"><span style=\"font-family: Comic Sans MS;\">Add the following entries in the resource.h file:<\/span><\/font><o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">#define<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> IDR_MENU_FROMSCRATCH<span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>501<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">#define<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> IDS_EXIT<span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>502<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">#define<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> IDS_REFRESH<span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>503<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">#define<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> IDM_EXIT<span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>504<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 0, 128);\">#define<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"color: rgb(0, 0, 128);\"> IDM_REFRESH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 505<\/span><o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><font size=\"2\"><span style=\"font-family: Comic Sans MS;\">And add the following stringtable in the .rc file:<\/span><\/font><o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">STRINGTABLE<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">BEING<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>IDS_EXIT<span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&quot;Exit&quot;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>IDS_REFRESH<span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&quot;Refresh&quot;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"color: rgb(0, 0, 128);\">END<\/span><o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"text-align: justify; font-family: Comic Sans MS;\" class=\"MsoNormal\"><font size=\"2\"><span style=\"line-height: 115%;\">I have explained all these in my previous posts, so I am not going to repeat them.<o:p><\/o:p><\/span><\/font><\/p>\n<p style=\"text-align: justify; font-family: Comic Sans MS;\" class=\"MsoNormal\"><font size=\"2\"><span style=\"line-height: 115%;\">Include resource.h in FromScratch.cpp. Add aygshell.lib in Additional dependencies (go to project properties, linker -&gt; input). As mentioned before we need aygshell.lib for <span style=\"font-family: Verdana;\">SHInitDialog<\/span>, <span style=\"font-family: Verdana;\">SHCreateMenuBar <\/span>etc.<o:p><\/o:p><\/span><\/font><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"\"><font size=\"2\"><span style=\"font-family: Comic Sans MS;\">Now all we need to do is, add the code for <span style=\"font-family: Verdana;\">FromScractchDlgProc <\/span>and invoke the dialog from main.<\/span><\/font><o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;;\"><font size=\"2\"><span style=\"font-family: Comic Sans MS;\">Here is the code for <span style=\"font-family: Verdana;\">FromScratchDlgProc<\/span>:<\/span><\/font><o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\">BOOL CALLBACK FromScratchDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\">{<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>int wmID, wmEvent;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>PAINTSTRUCT ps;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>HDC hdc;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>switch(uMessage)<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>case WM_INITDIALOG:<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>SHINITDLGINFO shidi;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>SHMENUBARINFO mbi;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>memset(&amp;shidi, 0, sizeof(shidi));<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>memset(&amp;mbi, 0, sizeof(mbi));<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>shidi.dwMask = SHIDIM_FLAGS;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_EMPTYMENU;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>shidi.hDlg = hDlg;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>SHInitDialog(&amp;shidi);<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>mbi.cbSize = sizeof(mbi);<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>mbi.hwndParent = hDlg;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>mbi.nToolBarId = IDR_MENU_FROMSCRATCH;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>mbi.hInstRes = g_hInst;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>if(!SHCreateMenuBar(&amp;mbi))<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>printf(&quot;FromScratch: Error creating menu bar, errcode:0x%x\\n&quot;, GetLastError());<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>}<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>}<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>return TRUE;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>case WM_COMMAND:<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>wmID = LOWORD(wParam);<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>wmEvent = HIWORD(wParam);<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>switch(wmID)<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>case IDM_EXIT:<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>EndDialog(hDlg, uMessage);<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>break;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>case IDM_REFRESH:<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>\/\/for now<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>EndDialog(hDlg, uMessage);<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>break;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>}<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>}<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>break;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>case WM_PAINT:<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>hdc = BeginPaint(hDlg, &amp;ps);<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>EndPaint(hDlg, &amp;ps);<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>}<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>break;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>}<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>return FALSE;<o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify; color: rgb(0, 0, 128); font-family: Verdana;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; line-height: 115%;\">}<\/span><span style=\"line-height: 115%;\"><o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"\"><font size=\"2\"><span style=\"font-family: Comic Sans MS;\">Again, I have explained about this in my previous <a href=\"http:\/\/geekswithblogs.net\/TechTwaddle\/archive\/2009\/04\/15\/applications-creating-a-simple-ui-application-for-windows-mobile-6.aspx\">posts<\/a>. Basically, <span style=\"font-family: Verdana;\">WM_INITDIALOG<\/span> is where you do your initialization part, set the dialog as fullscreen, add the menubar etc. There are no controls yet, so the <span style=\"font-family: Verdana;\">WM_COMMAND<\/span> is empty. However, we need to add the handling for the two menus that we added before. Invoke this dialog from main function:<\/span><\/font><o:p><\/o:p><\/span><\/p>\n<p class=\"MsoNormal\"><span style=\"font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;;\"><span style=\"color: rgb(0, 0, 128);\">DialogBox(hInst, MAKEINTRESOURCE(IDD_PPC_FROMSCRATCH), NULL, FromScratchDlgProc);<\/span><o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"line-height: 115%;\"><font size=\"2\"><span style=\"font-family: Comic Sans MS;\">Create a global variable to store the instance handle of the program:<\/span><\/font><o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;;\"><span style=\"color: rgb(0, 0, 128);\">HINSTANCE g_hInst;<\/span><o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"line-height: 115%;\"><font size=\"2\"><span style=\"font-family: Comic Sans MS;\">And in <span style=\"font-family: Verdana;\">WinMain<\/span>, store the <span style=\"font-family: Verdana;\">hInst <\/span>in <span style=\"font-family: Verdana;\">g_hInst<\/span>. <span style=\"font-family: Verdana;\">WinMain <\/span>now looks like:<\/span><\/font><o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">int<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>LPTSTR lpCmdLine, int nCmdShow)<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">{<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>\/\/MessageBox(NULL, L&quot;Hi there..&quot;, L&quot;Info&quot;, MB_OK);<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>g_hInst = hInst;<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>DialogBox(hInst, MAKEINTRESOURCE(IDD_PPC_FROMSCRATCH), NULL, FromScratchDlgProc);<o:p><\/o:p><\/span><\/p>\n<p style=\"margin-bottom: 0.0001pt; line-height: normal; color: rgb(0, 0, 128);\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>return 0;<o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;;\"><span style=\"color: rgb(0, 0, 128);\">}<\/span><o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;;\"><font size=\"2\"><span style=\"font-family: Comic Sans MS;\">And you&rsquo;re done. Here is the screenshot:<\/span><\/font><o:p><\/o:p><\/span><\/p>\n<p style=\"text-align: justify;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;;\"><img decoding=\"async\" loading=\"lazy\" width=\"353\" height=\"547\" src=\"\/images\/geekswithblogs_net\/TechTwaddle\/FromScratch\/DialogRunning.JPG\" alt=\"\" \/><o:p><\/o:p><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lets create a simple UI application for Win Mob 6 professional device, from scratch. When you create the project using the wizard you can see that basic code is already there. The main function, the window procedure etc. And then there&rsquo;s stdafx. I never quite understood what they are there for, but I guess they &hellip; <a href=\"https:\/\/techtwaddle.co.in\/blog\/2009\/05\/12\/applications-creating-a-simple-ui-application-from-scratch-part-1\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Applications: Creating a simple UI application from scratch, Part 1<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[1],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1ktFF-4N","_links":{"self":[{"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/posts\/297"}],"collection":[{"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/comments?post=297"}],"version-history":[{"count":1,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/posts\/297\/revisions"}],"predecessor-version":[{"id":298,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/posts\/297\/revisions\/298"}],"wp:attachment":[{"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/media?parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/categories?post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techtwaddle.co.in\/blog\/wp-json\/wp\/v2\/tags?post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}