{"id":2733,"date":"2009-05-21T13:43:00","date_gmt":"2009-05-21T13:43:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vbteam\/2009\/05\/21\/phoning-home-revisited-matt-gertz\/"},"modified":"2024-07-05T13:19:49","modified_gmt":"2024-07-05T20:19:49","slug":"phoning-home-revisited-matt-gertz","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/vbteam\/phoning-home-revisited-matt-gertz\/","title":{"rendered":"Phoning Home, revisited (Matt Gertz)"},"content":{"rendered":"<p class=\"MsoNormal\"><font size=\"3\" face=\"Calibri\">In my post &ldquo;<\/font><a href=\"http:\/\/blogs.msdn.com\/vbteam\/archive\/2008\/12\/09\/m-g-phone-home-matt-gertz.aspx\"><font size=\"3\" face=\"Calibri\">M. G. Phone Home<\/font><\/a><font size=\"3\" face=\"Calibri\">,&rdquo; I discussed how to write a simple phone application for Windows Mobile, using Visual Basic, which accesses the Bluetooth service.<span>&nbsp; <\/span>What I didn&rsquo;t discuss was how to deploy it to the phone via CAB.<span>&nbsp; <\/span>Since I purchased a new phone yesterday (a Samsung Saga, running Windows Mobile 6.1), and I&rsquo;ve discovered that I need the same app on it, I thought this would be an opportune time to discuss how to do this, since it&rsquo;s not obvious and slightly different from the distribution of &ldquo;normal&rdquo; applications.<span>&nbsp; <\/span>If you want to follow along, you can find the code at my <\/font><a href=\"http:\/\/code.msdn.microsoft.com\/templeofvb\"><font size=\"3\" face=\"Calibri\">Temple of VB<\/font><\/a><font size=\"3\" face=\"Calibri\"> site (direct release link is <\/font><a href=\"https:\/\/code.msdn.microsoft.com\/Release\/ProjectReleases.aspx?ProjectName=templeofvb&amp;ReleaseId=2717\"><font size=\"3\" face=\"Calibri\">here<\/font><\/a><font size=\"3\" face=\"Calibri\">).<\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\" face=\"Calibri\">(By the way, I&rsquo;ve modified the app&rsquo;s code slightly from what I wrote in that previous blog &#8212; I have assigned an icon to the application in the project&rsquo;s properties, because I got tired of seeing the default, non-intuitive icon.<span>&nbsp; <\/span>If you do this also, make sure that, after doing so, you select the icon in the project&rsquo;s files and, in the property grid, set its &ldquo;Build Action&rdquo; to &ldquo;Embedded Resource.&rdquo;<span>&nbsp; <\/span>If you don&rsquo;t do that last step, you won&rsquo;t see the icon on the phone.)<\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><font face=\"Calibri\">Once you&rsquo;ve got your phone app completed and debugged (as discussed in the aforementioned blog), choose &ldquo;File-&gt; Add-&gt;New Project.&rdquo;<span>&nbsp; <\/span>Select &ldquo;Smart Device CAB Project&rdquo; under the &ldquo;Other Project Types-&gt;Setup and Deployment&rdquo; tree node, and give the project some meaningful name (ResetBluetooth, for example).<span>&nbsp; <\/span>Select OK so that the project is created.<span>&nbsp; <\/span><\/font><\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\" face=\"Calibri\">In the property grid for the new project, make sure that &ldquo;Manufacturer&rdquo; and &ldquo;ProductName&rdquo; are set however you want them to be, since they will be visible in the program list on the phone.<\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\" face=\"Calibri\">Now, in the Solution Explorer, right-click the new project and choose &ldquo;Add-&gt;Project Output.&rdquo;<span>&nbsp; <\/span>In the resulting dialog, make sure that the first project is selected (the one with the actual code), choose &ldquo;Primary Output&rdquo; and click OK.<span>&nbsp; <\/span>The CAB project will now always contact that project to get its outputs when creating the CAB.<\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><font face=\"Calibri\">You&rsquo;re not quite finished, though.<span>&nbsp; <\/span>You need to add a couple of shortcuts so that you can actually interact with the program on your phone once it&rsquo;s installed.<span>&nbsp; <\/span>To do this, bring up the CAB project&rsquo;s File System Editor if it&rsquo;s not already visible (right-click the project, choose &ldquo;View-&gt;File System&rdquo;).<span>&nbsp; <\/span>In the left-hand pane, you should see &ldquo;Application Folder&rdquo; and &ldquo;Program Files Folder.&rdquo;<span>&nbsp; <\/span>&ldquo;Application Folder&rdquo; is where the code will end up; don&rsquo;t change anything about it.<span>&nbsp; <\/span><\/font><\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\" face=\"Calibri\">However, &ldquo;Program Files Folder&rdquo; is empty, and you need to add a shortcut to the program in it.<span>&nbsp; <\/span>Select that folder, and in the right-hand pane, right-click anywhere and choose &ldquo;Create New Shortcut.&rdquo;<span>&nbsp; <\/span>In the resulting dialog, navigate into the Application Folder and select &ldquo;Primary Output from ResetBluetooth (Active)&rdquo; (or whatever you called your original program).<span>&nbsp; <\/span>Click &ldquo;OK.&rdquo;<span>&nbsp; <\/span>The Shortcut will be selected for editing, and it will have an atrociously long, descriptive name &ndash; give it a more sensible name like &ldquo;Reset Bluetooth&rdquo; or something.<\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\" face=\"Calibri\">You&rsquo;re still not done, though &#8212; you need to add one more folder.<span>&nbsp; <\/span>Right-click the &ldquo;File System of Target Machine&rdquo; node in the left-hand pane and choose &ldquo;Add Special Folder-&gt;Start Menu Folder.&rdquo;<span>&nbsp; <\/span>Inside that new folder, add the same shortcut to the primary output that you added in the &ldquo;Program Files&rdquo; folder, and give it the same sensible name.<\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\" face=\"Calibri\">Now you&rsquo;re done.<span>&nbsp; <\/span>Build the CAB project, and you&rsquo;ll find the CAB file in its Release subdirectory.<span>&nbsp; <\/span>You can copy that over to your phone via the usual ActiveSync mechanism, and then run it on the phone to install it.<span>&nbsp; <\/span>(I usually map a phone key to that program so that it&rsquo;s trivial to launch the application &ndash; check your phone&rsquo;s manual for instructions on how to do that.)<span>&nbsp; <\/span>And that&rsquo;s it!<\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\" face=\"Calibri\">&lsquo;Til next time,<\/font><\/p>\n<p class=\"MsoNormal\"><font size=\"3\"><font face=\"Calibri\"><span>&nbsp; <\/span>&#8211;Matt&#8211;*<\/font><\/font><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my post &ldquo;M. G. Phone Home,&rdquo; I discussed how to write a simple phone application for Windows Mobile, using Visual Basic, which accesses the Bluetooth service.&nbsp; What I didn&rsquo;t discuss was how to deploy it to the phone via CAB.&nbsp; Since I purchased a new phone yesterday (a Samsung Saga, running Windows Mobile 6.1), [&hellip;]<\/p>\n","protected":false},"author":258,"featured_media":8818,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[22,195],"tags":[101,165,166],"class_list":["post-2733","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-matt-gertz","category-visual-basic","tag-matt-gertz","tag-vb2005","tag-vb2008"],"acf":[],"blog_post_summary":"<p>In my post &ldquo;M. G. Phone Home,&rdquo; I discussed how to write a simple phone application for Windows Mobile, using Visual Basic, which accesses the Bluetooth service.&nbsp; What I didn&rsquo;t discuss was how to deploy it to the phone via CAB.&nbsp; Since I purchased a new phone yesterday (a Samsung Saga, running Windows Mobile 6.1), [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/2733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/users\/258"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/comments?post=2733"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/2733\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media\/8818"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media?parent=2733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/categories?post=2733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/tags?post=2733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}