tag:blogger.com,1999:blog-73069785811086954832024-02-18T17:42:35.117-08:00Alin Constantin 's blogMostly technicalAlin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.comBlogger70125tag:blogger.com,1999:blog-7306978581108695483.post-49805393118451458622018-02-06T19:06:00.000-08:002018-02-06T19:06:17.804-08:00Remote VPN for Microsoft employeesOk, connection to Microsoft RAS/VPN is a problem for me every once in a while - IT keeps inventing things like "MSIT Connection Manager", "Microsoft IT VPN", "MSFTVPN", "MSIT AutoVPN", etc. And when things stop working and I have to delete all vpn connections/apps and start all over again, I don't know anymore where to get the connection apps...
I keep searching the net for <i>remote team partners extranet Microsoft employees</i> and combinations of those, as I remember the address used to be, to no avail. Based on Bing's suggestions, many others search for same things. Anyway, now I found it, so here is the correct address to use, for next time I'll need it:<br/><a href="https://microsoft.sharepoint.com/sites/itweb/remote">https://microsoft.sharepoint.com/sites/itweb/remote</a>.<br/>It has even a shorter link: <a href="http://aka.ms/remote">http://aka.ms/remote</a><br/>
Hopefully next time I'll remember to search my blog...
Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com0tag:blogger.com,1999:blog-7306978581108695483.post-47737998357796059522017-04-09T11:07:00.000-07:002017-04-09T11:07:21.278-07:00Windows Server Backup - Delete old backupI had turned on daily backups on my Win server, and in time I had accumulated almost 1000 backups from the last 3 years.
The Backup UI took ages to do any operation requiring enumeration of those (even changing the backup schedule), and unfortunately there is no easy way to delete old backups from the UI.
The solution there is to use command line. Here are some useful invocations:
<ul>
<li><b>wbadmin get disks</b> - lists the disk in system and the space used by the backups<br>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoLRlBBtHSFK4LLVPQ0ZhL_1M3vAx-gR3qzdp9-AzjdmyTi541m9Zv9rR5HToqH3_a9RBJqcBYMOeLPxle3oWM9niEzp5rY8yeYKaDn9jhpysm1pq6h1QH-ZkI12xpX35V_OrvXbe-D-0/s1600/disk.PNG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoLRlBBtHSFK4LLVPQ0ZhL_1M3vAx-gR3qzdp9-AzjdmyTi541m9Zv9rR5HToqH3_a9RBJqcBYMOeLPxle3oWM9niEzp5rY8yeYKaDn9jhpysm1pq6h1QH-ZkI12xpX35V_OrvXbe-D-0/s320/disk.PNG" width="320" height="53" /></a></li>
<li><b>wbadmin get versions</b> - lists the backup versions<br>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXhaIH_DWJ4JD3T_Hsfd6MUtFS_j-dDXLTLQTLJyO_wKUB2IuEHcRDKLHBKvDP2n9OAhZDa2w9tUOuRtSHwCZFA-eq369_eOn2o151nuJ8iiTordsogkgudIs-fASFlE8bl1OfpUHx8ME/s1600/version.PNG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXhaIH_DWJ4JD3T_Hsfd6MUtFS_j-dDXLTLQTLJyO_wKUB2IuEHcRDKLHBKvDP2n9OAhZDa2w9tUOuRtSHwCZFA-eq369_eOn2o151nuJ8iiTordsogkgudIs-fASFlE8bl1OfpUHx8ME/s320/version.PNG" width="320" height="30" /></a></li>
<li><b>wbadmin delete backup -keepVersions:10</b> - deletes older backups, keep the last 10 backups</li>
<li><b>wbadmin delete backup -version:04/08/2017-10:16</b> - deletes the specified backup version</li>
</ul>
Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com0tag:blogger.com,1999:blog-7306978581108695483.post-7223630488504975812016-11-27T19:03:00.002-08:002016-11-27T19:03:36.213-08:00Cookie limits - browser side<span style="font-family: inherit;">If you search the net for 'cookie limits', you'll find this site </span><a href="http://browsercookielimits.squawky.net/"><span style="font-family: inherit;"><span style="color: #5588aa;">http://browsercookielimits.squawky.net/</span></span></a><span style="font-family: inherit;"> (or variations of it). I was baffled that max total cookies size is a 'guess' within a fairly large interval. So I set to write my own version and hope to get more accurate numbers.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Here is the result: </span><a href="http://alinconstantin.com/download/browsercookies/cookies.html">http://alinconstantin.com/download/browsercookies/cookies.html</a><br />
<div>
<br /></div>
<div>
It turned out the limits guessed were accurate already (no variation interval was necessary). But it was interesting to learn more about cookies and javascript. Here are a few notes.</div>
<ul>
<li>JavaScript support for cookies sucks, it's a weird mechanism. Setting a cookie is done by setting a property, document.cookie, but reading back that property returns all cookies set (just names and values, even though cookies set could have other properties like path or expiration dates)</li>
<li>If you set cookies from JavaScript, don't forget to remember the names of cookies set in a separate list! If you set cookies with values that go over the browser limit per domain, browsers like IE/Edge will clear up the property document.cookie, and you'd have no way to enumerate existing cookies (to know what to delete before being able to set new cookies). Fwiw, this behavior is browser dependent, Chrome/FireFox will drop oldest cookies instead...</li>
<li>IE support for JavaScript sucks. In IE11, string.startsWith(), string.repeat() are not implemented, delegates var f1 = () => {dosomething();} are not understood, etc. Edge is better in this regard.</li>
<li>Chrome is silly, not allowing using cookies when scripts are run from file:// locations.</li>
<li>IE & Edge have very low limits for total cookies size. You probably don't want to send 10k cookies with every http request, but I've seen websites hitting these limits... 15k would have been more reasonable (and closer to the 16k default limit of header sizes in server side). On the plus side, 5k per cookie is better than the ~4k of all other browsers (and I've seen websites hitting that limit in other browser, too)(</li>
</ul>
<div>
Anyway, here are the results for cookies limits for the major browsers as of writing this article:</div>
<div>
<br /></div>
<div>
<table>
<tr>
<td><b>Browser </b></td>
<td><b>Max bytes/cookie </b></td>
<td><b>Max cookies </b></td>
<td><b>Max total bytes for cookies</b></td>
</tr>
<tr>
<td>IE11 & Edge</td>
<td>5117</td>
<td>50</td>
<td>2*5117 = 10234</td>
</tr>
<tr>
<td>Chrome 54</td>
<td>4096</td>
<td>180</td>
<td>180*4096 = 737280</td>
</tr>
<tr>
<td>Firefox r50</td>
<td>4097</td>
<td>150</td>
<td>150*4097 = 614550</td>
</tr>
<tr>
<td>Opera 41</td>
<td>4096</td>
<td>180</td>
<td>180*4096 = 737280</td>
</tr>
</table>
</div>
<br />Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com0tag:blogger.com,1999:blog-7306978581108695483.post-65162520791788741262016-11-24T23:35:00.000-08:002016-12-16T12:58:22.639-08:00Cookie limits - the server side story<span style="font-family: inherit;">If you search the net for 'cookie limits', you'll find this site </span><a href="http://browsercookielimits.squawky.net/"><span style="font-family: inherit;">http://browsercookielimits.squawky.net/</span></a><span style="font-family: inherit;"> (or variations of it) that list browser-side limits for cookies for a couple of browsers. </span><br />
<a href="http://www.ietf.org/rfc/rfc2965.txt"><span style="font-family: inherit;">RFC2965</span></a><span style="font-family: inherit;"> will tell you a browser should support at least 20 cookies of size 4096 bytes per cookie, but browsers usually support higher limits. E.g. Chrome supports 180 cookies of size 4096 bytes, per domain, with no limits for the total size of all cookies. That makes 720Kb of data that is allowed by Chrome in each request.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">In reality, even if you insist of sending that crazy big amount of data with every http request, you'll discover it's impossible to use that many cookies. Depending on the server accessed, you may be able to use only max 3 cookies of size 4096 bytes! </span><span style="font-family: inherit;">Why? Because there is another side of the story - the servers you are accessing will also limit your use of cookies sizes.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Those limits depends from http server to server, and the server response if you make larger requests varies, too. Here are some examples:</span><br />
<ul>
<li>www.microsoft.com - throws SocketException / ConnectionForcefullyClosedByRemoteServer after ~16k max cookies</li>
<li>portal.office.com - Starts returning "400 Bad Request – Request Too Long. HTTP Error 400. The size of the request headers is too long" after max ~15k cookies<br />www.google.com - Starts returning 413 Request Entity Too Large after ~15k cookies</li>
<li>www.amazon.com - Starts returning 400 Bad Request after ~7.5k</li>
<li>www.yahoo.com - Accepts requests up to ~65k, after that returns 400 Bad Request </li>
<li>www.facebook.com - Accepts about ~80k after that starts returning 400, 502 or throws WebException/<span class="selflink">MessageLengthLimitExceeded</span> (seems dependent on the number of cookies, too)</li>
</ul>
<span style="font-family: inherit;">Per </span><a href="https://support.microsoft.com/en-us/kb/820129"><span style="font-family: inherit;">https://support.microsoft.com/en-us/kb/820129</span></a><span style="font-family: inherit;">, IIS Server defines two configuration settings, MaxFieldLength and MaxRequestBytes that limits the size of the http request headers that are accepted. This includes things like the RequestUrl being accessed, the User-Agent string, AAD authentication tokens, etc, thus limiting the size of Cookies stored in headers, too. For IIS, that limit is 16Kb by default, and can be configured. Probably Apache has similar limits, and website owners may have adjusted the limits. </span><br />
<br />
If you're writing a web application and use cookies pushing the limits, it's important to know what your server will tolerate on incoming requests.<br />
<br />
I wrote an app one can use to test and get an idea of the server limits. You can download it from <br />
<a href="http://alinconstantin.com/Download/ServerCookieLimits.zip">http://alinconstantin.com/Download/ServerCookieLimits.zip </a>and invoke it with the http:// Uri of the server to test for parameter. The app makes requests to the server with cookies of various decreasing sizes, trying to narrow down the accepted max cookies size. The output looks like in the picture below.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOtdBW0ehfXf2WShk_1Pnn92aIS_H3QlC0GpbJzXoHfHrRPiRpI1roRieAkNs4zVj4EpMhve8j_yXCWRGwFS8etUhdV15Jn3pq_PVfmOWZkSOtCKFai6VdfPWie2D-gyxk2iEYKToZ9GM/s1600/Cookies.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="301" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOtdBW0ehfXf2WShk_1Pnn92aIS_H3QlC0GpbJzXoHfHrRPiRpI1roRieAkNs4zVj4EpMhve8j_yXCWRGwFS8etUhdV15Jn3pq_PVfmOWZkSOtCKFai6VdfPWie2D-gyxk2iEYKToZ9GM/s320/Cookies.png" width="320" /></a></div>
<br />Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com0tag:blogger.com,1999:blog-7306978581108695483.post-12680776947641987462015-09-05T12:44:00.000-07:002015-09-05T12:44:05.536-07:00Useless router WiFi speeds and maximum Surface Pro 3 Wifi speedI got puzzled last week by my Surface Pro 3, which usually connects at 60-90Mbps to my router, regardless of which band (2.4 or 5Ghz I choose). I knew Surface 3 had some problems with low WiFi connection speeds when it was released, but since then Microsoft has released drivers and firmware updates that were supposed to fix the problem. I upgraded to an AC router, Surface Pro also has AC adapter, so why am I not seeing better speeds?<br />
My WiFi router is a Netgear Nighthawk R8000, which boasts a 3.2Gbps WiFi speed. That's just for PR, in reality, it has one 2.4GHz band with max 600Mbps and two 5GHz channels, each supporting max 1300Mbps. So, the max speed of connection is limited to the max speed of the band I'm using. But, that's not the end of the story - both my Surface Pro 3 and my wife's laptop connect at maximum 866.5Mbps, and that's when staying 2-3 fests apart from the router. The speed is actually negotiated between the router and the client device. If I move 10 feet away, the speed starts dropping to 700Mbps. If I stay in living room, the speed drops to 80-90Mbps. <br />
Surface 3 Pro has a 'Marvell AVASTAR Wireless-AC Network Controller' Wi-Fi adapter, and based on http://www.marvell.com/wireless/avastar/88W8897 it's maximum WiFi speed is 867Mbps.<br />
I'm reaching this speed (so Microsoft kept its promise and fixed the low speed problem), but I have to be feet apart from the router to reach it. And even in these ideal conditions I'd need at least 4 Surfaces to saturate the two 5GHz channels plus more WiFi devices connecting on 2.4GHz to reach the advertised router's speed... The router speeds are just a PR gimmick.<br />
<span style="font-size: x-small;"><br /></span><br />Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com1tag:blogger.com,1999:blog-7306978581108695483.post-72244674943669041982014-11-02T21:30:00.001-08:002014-11-02T21:30:20.219-08:00Digital Photo Professional cannot edit CR2 RAW files<p>Today I spent almost one hour trying to figure out why Canon DPP was not able to edit some pictures I took a while ago. All the pictures in one folder were shown like this:</p> <p><a href="http://lh4.ggpht.com/-TchhCbNtc6s/VFcS4sVeDjI/AAAAAAAAAjg/1NigFyTsdaY/s1600-h/DPP_NoEdit%25255B3%25255D.png"><img title="DPP_NoEdit" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="DPP_NoEdit" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcKc2gieHlEnL3cvIs4z9C6XHkRKI-0ubARu7NPHc3sdjgzeRUxX1kNx6r7k0QAx0bfkzleFQLgDVcvgMTApgJv9_dSUdpCG9miUP_crwtPQJPYACUb6VtOlJjgoE2PhRP_3Rh7_NpH08/?imgmax=800" width="548" height="361" /></a></p> <p>Notice the glyph on top of each image indicating editing was not allowed. </p> <p>I searched 3 times the menus for some option to unblock editing, but there was none. I thought of files being read-only on disk, having wrong ACLs. Nothing. Some website suggested for images being edit-protected from the camera to access an unblock option from the Info window, but that was completely empty instead of displaying EXIF info.</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLJbgFHv0XPe9H7kM7u4oEFlK_5CaJIF0cqgoHPwCqU872VcgZDFWGkVDuMSdIBrlZ0YUFi7wOPvONcNhYLg7pcPFRlRDnypvUF9URb0uEEbKM8t-hCo9euTlmpwliV5YciEcKUaBXzMs/s1600-h/EmptyInfo%25255B3%25255D.png"><img title="EmptyInfo" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="EmptyInfo" src="http://lh6.ggpht.com/-EtV2HPMkEYs/VFcS56EfB8I/AAAAAAAAAj0/yfaHte3x1dU/EmptyInfo_thumb%25255B1%25255D.png?imgmax=800" width="444" height="304" /></a></p> <p>It was only happening with images in one folder, so I moved an image out of that folder, but nothing changed.</p> <p>Hours later I viewed the images in Explorer from a different computer, and then I noticed something odd – why was the CR2 size so small as compared with other pictures? Were they corrupted?</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu-YyPEX0erWHMwx9GmvmQcj4fTYf1POuriwkh1QbIB7POLTkOCMH86UA0KpFL6FxHNvjDpRmPnpGW90l-bRNuBJ-ERnDgQUIiTHLB7scOeXNgd3FMDxXlw2zdT_RaNnTqmGlbPzT8tpg/s1600-h/Files%25255B3%25255D.png"><img title="Files" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Files" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihgG3fTgPArQiIJh-fVqr7oQHmP_fmOaKPKy55J5V4mRpZweWEU3Foz7mlazSb1QsVDpyq3IZety4yRK069NNmca-j8oJbqn9EltcwwFyuZlo3ZJZwuW04g1aqDj-VZMs1MW-xzSN5ODk/?imgmax=800" width="602" height="90" /></a></p> <p>And then it hit me – when I took those pictures the camera battery run out on my 5D III and I had to use my old camera, a Canon 20D. And DPP was not able to open the files from this older camera…</p> <p>After a little digging on the net, I had the confirmation: Canon has released Digital Photo Professional 4.0, but only for 64-bit computers and only for certain cameras like Canon 5D Mark III. Older camera like Canon 20D are not supported by DPP 4, and instead I had to download the previous version, DPP 3.14 to edit the raw files. It turns out that even new cameras from Canon like 7D mark II are not supported by DPP 4.0, on either 32 or 64-bit Windows. Hopefully Canon will reconsider and add compatibility support for all the cameras when they release a new version of DPP 4… </p> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com9tag:blogger.com,1999:blog-7306978581108695483.post-40687658047966022232014-09-18T13:36:00.000-07:002014-09-18T13:36:34.321-07:00How to install Active Directory (AD) tools on Windows 8Start by installing <a href="http://www.microsoft.com/en-au/download/details.aspx?id=39296" target="_blank">Remote Server Administrator Tools For Windows 8.1</a> to get the 'Remote Server Administration Tools' components, then Turn Windows features on/off, and make sure to select 'AD DS Tools'.<br />
<br />
This article describes in great details the steps<br />
<a href="http://www.technipages.com/windows-8-install-active-directory-users-and-computers">http://www.technipages.com/windows-8-install-active-directory-users-and-computers</a>Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com0tag:blogger.com,1999:blog-7306978581108695483.post-50598179974319686952014-06-01T10:33:00.001-07:002014-06-01T10:33:58.171-07:00My Wi-Fi connection not using full speed of 300Mbps<p> </p> <p>I have two Netgear Wi-Fi routers that have Wi-Fi connections enabled with speeds up to 300Mbps. However, the laptop, tablet, etc connects to them with speeds usual in the 78-144Mbps range, never over 150Mbps. This didn’t bother me much as these speeds are still over my broadband connection speed (60Mpbs), and I don’t transfer many files between laptop and other computers in the network. But still, why does this happens?</p> <p>The <a href="http://documentation.netgear.com/wnr3500/enu/202-10305-01/WNR3500_RM-04-05.html">documentation</a> says “The WNR3500 router will use the channel you selected as the primary channel and expand to the secondary channel (primary channel +4 or -4) to achieve a 40 MHz frame-by-frame bandwidth. The WNR3500 router will detect channel usage and will disable frame-by-frame expansion if the expansion would result in interference with the data transmission of other access points or clients.” </p> <p>I thought the low speed was caused by router settings. My router had channel 4 set as primary, which left only 4+4=8 as secondary. I thought some interference on channel 8 was preventing it to be used, so I changed the primary to 5, with 1 and 9 now as options for secondary. But that didn’t increase the connection speed.</p> <p>Today, after digging more, I looked on laptop at adapter’s settings. There, the Channel Width on 2.4GHz range was set to “20 MHz Only”. I set it to Auto, let the laptop reconnect, and voila! Now the speed increased, reaching values in the 270-300Mhz range, as it should have.</p> <p><a href="http://lh6.ggpht.com/-61V66Jfn9kI/U4tg976nB4I/AAAAAAAAAiM/C01XaShEPB8/s1600-h/image%25255B4%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvnQGWivO8QOez8mr2fwee1fPioz6eLlMJd1OiCusLgwvxU2qfKzL8iPBSQyjiiiaAfc8WBbPZ2K-x9OXbvNo8HgmHeqsFG06wK1lXy5ywzBf8TifD599EaJzL7cTH2Lt9O5RBdklRdzw/?imgmax=800" width="419" height="467" /></a></p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4T4nhfghwrvHJfQ9WZWcLiB_fitWi9j9pPG6NWvRlxbmUl6hDgFfttibW1SfjM83W9wEN2D9Uv2rdqZnr4RQPOfXA79Baiz7Umueie8ciSuZJ2B5izrQJkXJLnNg_g4lBZP33lpxOK0M/s1600-h/image7.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioHNo7XXfuJSK_9GnN1n2878odBpnS5dNtC9zUM5Y_X_VAajxlnB3mUwRXPrMOKKHUR3Qic3CHM5G5nKXNRoooFH0u1XwCDkzFfcBxtybegYQ9W9-ZDZvneQxPK5Z9a3rGfRZAYKtem4E/?imgmax=800" width="204" height="244" /></a></p> <p>It didn’t make sense, why won’t be this set to Auto by default? Then I remembered. It was.</p> <p>3 years ago I was experiencing frequent connection drops, and a lot of reconnecting – I was not able to maintain a RemoteDesktop connection to work without the laptop pausing for reconnect every couple of minutes. It was really annoying. And it was me who limited the channel width to 20MHz, which seemed to reduce the number of connection drops.</p> <p>Well, now I have a second Wi-Fi router to extend the range, and the laptop’s connection at 300Mbps seems more reliable now. So I guess I’ll keep the laptop’s channel width back to its default settings. </p> <p>Unfortunately the Surface RT’s network adaptor doesn’t have a similar setting, so the tablet will have to connect to 150Mbps max. No loss there until Comcast will allow such speeds at reasonable prices.</p> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com0tag:blogger.com,1999:blog-7306978581108695483.post-19878199801723497702013-11-27T16:49:00.001-08:002014-03-09T22:33:52.597-07:00Using Visual SourceSafe 2005 with Visual Studio 2010, Visual Studio 2012 and Visual Studio 2013<a href="http://support.microsoft.com/lifecycle/search/default.aspx?alpha=Visual+SourceSafe">Visual SourceSafe is out of mainstream support</a> since 2012 and will be in Extended support until 2017. However, may people use the product past its lifetime dates, if for no other reason at least because they have programs developed originally and stored in VSS databases that will still need maintaining.<br />
Microsoft Visual SourceSafe 2005 will still install on modern computers, and will still integrate with recent version of Visual Studio<br />
<a href="http://lh5.ggpht.com/-ZN1hrjrUN5Y/UpaS9IO6-nI/AAAAAAAAAfM/YGDlpz--GwE/s1600-h/image3.png"><img alt="image" border="0" src="http://lh5.ggpht.com/-fgpsw_iNnDA/UpaS9uSwkkI/AAAAAAAAAfQ/5COs2LxJ0fQ/image_thumb1.png?imgmax=800" height="296" style="background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="759" /></a><br />
<h4>
<strong>Opening projects from source control</strong></h4>
Visual SourceSafe 2005 was changed from VSS 6.0 and integrated with the File/Open Project/Solution dialog in Visual Studio. On Windows XP, Vista (and 7, I think), the Open dialog showed a dedicated ‘Visual SourceSafe’ icon in the tray, so it was intuitive to discover the Open from source control functionality. Since then, Windows changed the layout of the Open dialog, and SourceSafe option can only be found if you scroll the folders tree to the top…<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipKnZYfsX4iWWMIV4hyAORskqzG_aTJybX4y5C8Ibj6-ne34L-G4hyphenhyphenCehSSUcLFUO4CPzC18eId1fH4zdpp3ei8Z3DyDOBuqyk1FYkvxrkJmyXQAZVqcd7ZT2ph0IBLSvFMMUep7cOdqg/s1600-h/image39.png"><img alt="Open Project from SourceSafe in VS 2005" border="0" src="http://lh5.ggpht.com/-8LjBACK_HqQ/UpaS-d4lO2I/AAAAAAAAAfg/-Uh-ExFnJaw/image_thumb27.png?imgmax=800" height="158" style="background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="244" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg08668NqtCfFYgYEq-f62fOIEOu2at0ZnBF5IWoloOJNACukK6IXVb6QmoEom4QbzuC2b1c4ljNqrrps-gaUrQ0FtFeQHiF-TwrQ_ERdipZ2n7qL1F4i-AEVarQdt-1VIOVJ-mkCdPVNU/s1600-h/image59.png"><img alt="image" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi34n_oAtgmdMR7OzxCLcEQGUFOew8C3dYcIRitQQjSXNA0FU3EWJmb8BSg4iuk8jg80QIiXBNj06e8Xxz7wZZUlW2NOtiBKsSTpGc21PfSi3Ao0HMXKcZCYiUFlpdY-hMDFGlCjLdCe30/?imgmax=800" height="162" style="background-image: none; border-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="244" /></a><br />
Even worse, the namespace extension providing integration with Explorer and the Open dialogs broke during the years. Here are the options on how to fix the Open From Source Control functionality:<br />
<h4>
A) Use SourceSafe 6.0 way of opening from source control.</h4>
When it integrated with the File/Open dialog, SourceSafe 2005 has set some registry keys that make VSS Integration package in VS hide the OpenFromSourceControl commands under File/SourceControl menu. You can modify the registry and bring back those commands: <br />
1) Using regedit, open the registry and locate under <br />
<span style="font-family: Courier New;">[HKLM\SOFTWARE\Microsoft\SourceSafe\Namespace Extension] <br />DisableOpenFromSourceControl == (DWord)1.</span><br />
2) Change the value to <span style="font-family: Courier New;">(Dword)0</span> or delete the value completely. There will be a similar value for SourceSafe Internet provider under Microsoft\SourceSafe\RemoteAccess\Namespace Extension, change that as well<br />
(Note: The values are under Wow6432Node hive on 64-bit machines)<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimBXGZCRBpcNzTQawZPXa0HLRZP54XX9lXOifEca4BX0V-KCupmtT0mlKPQzmQemEa0oSZd0ZfyilmKVnBE0ZPbaunpCPwLQ8vtH76A8Wc5vU2Mda8X7V8ysN9s-payfTf8kq_WC3eu-I/s1600-h/image63.png"><img alt="image" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgClD1nEpwnTp2h2FFm1uYZSIOCMX3rbC95jDTGYI6hHxxYshHPPc1Y7LBYjKVl0-oES4S68xy3f3u6WUP889jNRxRyupMLEDp9Qqfx_NZzSlV2Lp749z_YaOz-Zw5M6BXiWzucewXoToY/?imgmax=800" height="278" style="background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="1149" /></a><br />
3) Restart Visual Studio and now you should have under File/SourceControl a menu item that allows opening solution from source control. <br />
<a href="http://lh3.ggpht.com/-bOxNr6ipe3Q/UpaTAjDmZ8I/AAAAAAAAAgI/1W_csovYwvU/s1600-h/image67.png"><img alt="image" border="0" src="http://lh6.ggpht.com/-WGoUSVd5U4s/UpaTBAejyeI/AAAAAAAAAgQ/EHGZ4zlp6Tc/image_thumb41.png?imgmax=800" height="439" style="background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="630" /></a><br />
4) Make sure to select a different location when opening from source control in a new enlistment (the equivalent of “Change Destination Folder” in the open functionality from the OpenProject dialog)<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbfpeZCe914ZloQstScQkR8HruhC9sC7qoks-zyNg1-2PjyLZclW7_2jqd0hNzHV1BJyr-6Yx1rAIe1a4JhlfIrMHwGpfvfbITlZJ468apfnur0xlCY-VNIbRiwLU_PK5stHYfqFwG5wI/s1600-h/image71.png"><img alt="image" border="0" src="http://lh6.ggpht.com/-lYjvnxLqiD4/UpaTB9vYdRI/AAAAAAAAAgk/FlXG_NJyA-g/image_thumb43.png?imgmax=800" height="357" style="background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="406" /></a><br />
<h4>
B) Fix the namespace extension.</h4>
1) If you installed VSS 2005 RTM and try to navigate the namespace extension you will see there are no items available under SourceSafe node. Clicking on the SourceSafe icons in the tree results in an error message “No such interface supported”<br />
<br />
<a href="http://lh6.ggpht.com/-4vSrpGFKkjM/UpaTChLBJRI/AAAAAAAAAgo/r3iyMbMrqGo/s1600-h/image%25255B9%25255D.png"><img alt="image" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP402wcVBeNcuf_5MaaUqBG8cZwRCj9d-zZ1n5rEvGpPOyhS9o9CiGCjJ_Rnvf4kgCHRZ0dDm_FNNdfRqLSA2RXXC2IqvJEHiluxU7YdmToim9Gn4ktzaRR6bMsE0V08yciM3qwmXyN8s/?imgmax=800" height="161" style="background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="244" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgF2qvOTiynNwht8v4lr6Obq8BTZPwR4nJlyiXlCYBxGyPn7WSxCHVc7MNGvk7RHFp2QdqOcaVbJ_GmSqAb2NfD54QToK7gXB2v4W6D1t4cBir3W3pAf1oOozIbXgxmbMhiBmm48I6-4gM/s1600-h/image%25255B12%25255D.png"><img alt="image" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW-G1cWZGe_fsvyqc_1dwGIjwHmV962b73fi5QFe48xNeR_k-RlBnzD8ZyPLXx02MEvG7tZcTlv9slnqIfPVAruWhiZaUJYKJM3i674X61ESwRPp-f5qWGJp_Q-N4RS6CtNsYF_Xe0CSU/?imgmax=800" height="162" style="background-image: none; border-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="244" /></a><br />
This error has been fixed in the <a href="http://www.microsoft.com/en-us/download/details.aspx?id=291">SourceSafe 2005 Update build</a>, so please install <a href="http://www.microsoft.com/en-us/download/details.aspx?id=291">VS80-KB943847-X86-INTL</a> (which you should do anyway)<br />
2) Now you should be able to navigate the SourceSafe databases in the File/Open dialog, you should be able to select a solution or project and change the scc location, however, when you’ll try to open the solution Visual Studio will display another error message “The selected file is not a valid solution file”.<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5sEL5mdeJl_2XLaQ2-7wnGavEXoN9rvcMYFMCuHMUUegCU3ndk-ECYji7fazPzOIFySJBDn0ocFiUHo3NB3Xw_zxB5_9XPJyDG5l1RqhnqlRrdk0thfBkRb9gqwwGZe-YIsNqOyTJBuA/s1600-h/image%25255B15%25255D.png"><img alt="image" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1QqiUYDJfoNNf8-CQs8COP7SuOIkei9UGW1MV2LfEiiOQxc9DA1rUz-yZP5iaHiceQBpGVWAy-VeIOO17sLMFO_PmlbUwBoJG0j_ay_4cgi6reE5194x1CZZqXrkYIjGrCD4jEDpEtrY/?imgmax=800" height="125" style="background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="244" /></a><br />
Why does this break? Surely you’ve selected a solution file! In order to return the path to the solution to VisualStudio, TDNamespaceExtension.dll which is the NSE deployed by SourceSafe needs to create a URI like msss://SoursafeDatabasePath/~files/PathToTheSolution (there’s more to that, but you get the idea). Unfortunately the MSSS scheme parser is a component implemented by a dll that ships with VisualStudio, so in order to create the parser TDNamespaceExtension looks up in registry under Visual Studio registry hive; as SourceSafe 2005 shipped in the box with Visual Studio 2005 (VS 8.0), it looks under this registry key<br />
HKLM\Software\Microsoft\VisualStudio\8.0\CLSID\{53544C4D-CFBF-404e-9E37-19C8BB80F6E3} <br />Of course this key does not exist if you install a more recent version of Visual Studio…<br />
For Sourcesafe to find the correct parser, the TDNamespaceExtension.dll had to be updated to look under the right key. To make VSS work with VS2008 and VS2010 Microsoft released patches to TDNamespaceExtension (e.g. <span style="color: #5588aa;"><a href="http://archive.msdn.microsoft.com/KB976375">KB976375</a> </span>is what you can install for VS2010). But for VS2012 and VS2013 Microsoft hasn’t released anymore such updates, probably due to SourceSafe reaching the end of mainstream support. <img alt="Sad smile" class="wlEmoticon wlEmoticon-sadsmile" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBKoKrM9rSse8M_PXFt9xYjRp6L51LdsIvJW-0C0j1h41HFItNArd97PigOwyC37iN4OXvgG9AHfZaR3TDJlcUj7tOTSmL8n3Bh98Sf3kqI9N1THZXMiKKzNrguLpRdtaqw8cNSJY6b5Q/?imgmax=800" /><br />
If you have multiple versions of VisualStudio installed (e.g. I have VS2010, VS2012 and VS2013 installed) and have fixed VSS to work with one version of VS you won’t (I have fixed it for VS2010 installing the KB article mentions above) you see this problem in the other versions, because VSS is able to find the parser from that version of VS (from VS2010 in my case).<br />
Anyway, it’s easy to fix the problem manually even without KB articles, by setting a registry value which tells SourceSafe where to locate the MSSS scheme parser. Besides looking under the VS 8.0 hive, TDNamespaceExtension also looks in a common place, under <span style="font-family: Courier New;">HKCU\Software\Classes\CLSID\{53544C4D-CFBF-404e-9E37-19C8BB80F6E3}</span><br />
So we can register the parser there, pointing to the current version of Visual Studio you have installed. E.g.: <br />- Save the content below to a file with .reg extension <br />- Edit the 12.0 if necessary and replace with the version of VS you have installed <br />- Double click the file and import it into registry. <br />
<span style="font-family: Courier New;">---------------------------------------------------------------------------------</span><br />
<span style="font-family: Courier New;">Windows Registry Editor Version 5.00</span><br />
<span style="font-family: Courier New;">[HKEY_CURRENT_USER\Software\Classes\CLSID\{53544C4D-CFBF-404e-9E37-19C8BB80F6E3}] <br />"InprocServer32"="C:\\Program Files\\Microsoft Visual Studio<strong> <span style="color: red;">12.0</span></strong>\\Common7\\IDE\\VS SCC\\VssProvider.dll" <br />"ThreadingModel"="Both" <br />@="VAPI Scheme Parser Msss"</span><br />
<span style="font-family: Courier New;">---------------------------------------------------------------------------------</span><br />
Now you should be able to open file from source control using the File/Open/Project without running into the “The selected file is not a valid solution file” error.<br />
<br />
Note: The above file worked for me on a 32-bit machine. On my 64-bit machine, I have the VAPI parser registered under multiple locations (I think the last one is written by VS setup and gets copied into 12.0_Config hive on first run); it won't hurt to register it similarly though.<br />
<span style="font-family: "Courier New", Courier, monospace;"></span><br />
<span style="font-family: "Courier New", Courier, monospace;">---------------------------------------------------------------------------------</span><br />
<span style="font-family: "Courier New", Courier, monospace;">Windows Registry Editor Version 5.00</span><br />
<span style="font-family: "Courier New", Courier, monospace;">[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{53544C4D-CFBF-404e-9E37-19C8BB80F6E3}]<br />@="VAPI Scheme Parser Msss"</span><br />
<span style="font-family: "Courier New", Courier, monospace;">[HKEY_CLASSES_ROOT\<strong><span style="color: red;">Wow6432Node</span></strong>\CLSID\{53544C4D-CFBF-404e-9E37-19C8BB80F6E3}\InprocServer32]<br />@="C:\\Program Files <strong><span style="color: red;">(x86)</span></strong>\\Microsoft Visual Studio <span style="color: red;"><strong>12.0</strong></span>\\Common7\\IDE\\VS SCC\\VssProvider.dll"<br />"ThreadingModel"="Both"</span><br />
<span style="font-family: "Courier New", Courier, monospace;">[HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\{53544C4D-CFBF-404e-9E37-19C8BB80F6E3}]<br />@="VAPI Scheme Parser Msss"</span><br />
<span style="font-family: "Courier New", Courier, monospace;">[HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\{53544C4D-CFBF-404e-9E37-19C8BB80F6E3}\InprocServer32]<br />@="c:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\VS SCC\\VssProvider.dll"<br />"ThreadingModel"="Both"</span><br />
<span style="font-family: "Courier New", Courier, monospace;">[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\CLSID\{53544C4D-CFBF-404e-9E37-19C8BB80F6E3}]<br />"InprocServer32"="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\VS SCC\\VssProvider.dll"<br />"ThreadingModel"="Both"<br />@="VAPI Scheme Parser Msss"</span><br />
<span style="font-family: "Courier New", Courier, monospace;">[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\CLSID\{53544C4D-CFBF-404e-9E37-19C8BB80F6E3}]<br />"InprocServer32"="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\VS SCC\\VssProvider.dll"<br />"ThreadingModel"="Both"<br />@="VAPI Scheme Parser Msss"<br />---------------------------------------------------------------------------------</span>Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com8tag:blogger.com,1999:blog-7306978581108695483.post-25278800902701142672013-11-27T10:48:00.000-08:002013-11-27T10:48:33.536-08:00Pwned<br />
Today I had my system infected with a trojan. I don’t even remember when it was the last time to have one… The worst part of it – I didn’t get it by visiting dubious sites (pr0n, warez), but from a news site (<a href="http://news.com/">http://news.com</a>). Most likely the malware was masquerading as an ad and exploited some unpatched hole in Adobe Flash (caveat!) as the site is full of Flash advertisements and had problems in the past, too.<br />
I was browsing the news and suddenly the browser disappeared (crashed). I restarted it thanking Adobe and thinking nothing more of it. Soon after that, problems appeared.<br />
The first red flag was an elevated prompt from Windows 7, asking for permission to run ‘SoftwareUpdate.exe’. Since I was not installing anything, I canceled it. Yet the prompt came again, and again, and again. From the dialog’s details, the program was "c:\Users\alinc\AppData\Local\temp\SoftwareUpdates.exe", so I renamed the executable to *.exe_ extension, and canceled the prompt again. This time I got error messages that updates can’t be installed, so I set up to investigate who was displaying it. To my surprise, I could not launch TaskManger (taskmgr.exe) nor <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653">SysInternal’s ProcessExplorer</a> (procexp.exe). As soon as the programs were started, they were closed automatically... It was clear now I was infected.<br />
I logged off, and switched users, logging in with a different local Administrator account. Problems occurred here as well, I still could not launch ProcExp. Soon I started to get tons of error messages “A Write command during the test failed to complete”, culminating with a “System error, hard disk failure detected”. All the icons on desktop disappeared leaving only one “Smart_Hdd” shortcut.<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifjd90qiiWTYstFZXlWXKx7ap-0dFOFvYhYi-ROnIgRGezQPAK3LFMcFJs1rxDWeYAV9k4y7xvApvuM3jK1DTpc6M4xAysd5-QEKjpQiY7P9mE4wdFOfX-33wjaYaXaoOWoLEbz5lX248/s1600-h/Screenshot2%25255B4%25255D.png"><img alt="Screenshot2" border="0" height="403" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8cgG8TYapViCHHWFt34qiAuHTVFvvQpjjOCdHMRz2lPW_aklwrDgqQ2700dGB9Kgwvr_TSHMo3BSxXkJF1FX2CrEejn0FgrUdStbAh93IdYCd9W5ysbgpvOG_YRqnmC5khJWrd0nwEd0/?imgmax=800" style="background-image: none; border: 0px currentColor; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="Screenshot2" width="619" /></a><br />
I opened a command prompt and stated to see problem here as well - folders and files disappeared from ‘dir’ commands. I renamed procexp.exe to something else (alin.exe) and this way I was able to launch it without being closed anymore. You can see in one look Process Explorer highlighted in gray 2 suspect programs (C:\ProgramData\rmIhrYfwFjUdy.exe and C:\ProgramData\QFUDzzwTiL1aQy.exe): they had weird names, were launched from ProgramData, had no Description or CompanyName.<br />
<a href="http://lh3.ggpht.com/-fLl4tkPoYT4/T3esZT9-KBI/AAAAAAAAAP4/Yj9TViCg1nI/s1600-h/screenshot1%25255B7%25255D.png"><img alt="screenshot1" border="0" height="426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvRhfzNr3i-4zY2qKAGJUqf8FHF7fdjWIVXMVBDu-qv3IQn_inswwv7rgi21XORhwqWF6NIreFFUa_atacxr_qiNbL8E3JHaqapd8MaBFuUxEwZFHORjK6Ef0XJhQa-VtPG11fSeSMviQ/?imgmax=800" style="background-image: none; border: 0px currentColor; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="screenshot1" width="627" /></a><br />
Even more worrying, rmIhrYfwFjUdy.exe had launched a recursive “attrib.exe /s +h \*.*” (not shown, I killed it immediately)– this was hiding all the files and folders on my computer! I believe all these was a scamming scheme to convince me into buying some “cleanup program” that would fix the “hard drive failures” “detected” and reported in the previous messages.<br />
I tried to stop/kill the malicious programs by pressing Delete, but those were protecting each other – as soon as one was killed, the other one was immediately starting it up again. The solution is to right click them, and use “Suspend” command. Suspend both, then you’ll be able to kill them without coming back. Now I could move the binaries out of the way for my collection and investigate further.<br />
I run another Sysinternal/Microsoft tool, <a href="http://technet.microsoft.com/en-us/sysinternals/bb963902">Autoruns</a>. This indicated rmIhrYfwFjUdy.exe was launched at logon time via a registry value written under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run. I deleted that as well. <br />
I updated <a href="http://windows.microsoft.com/en-US/windows/products/security-essentials">Microsoft Security Essentials</a> to the latest definitions, and I started a scan. With latest definitions, it flagged as malware two of the binaries. QFUDzzwTiL1aQy was recognized as <a href="http://www.microsoft.com/security/portal/Threat/Encyclopedia/Entry.aspx?name=Trojan%3aWin32%2fBumat!rts&threatid=2147626069">Win32/Bumat!rts</a>, and SoftwareUpdate was recognized as <a href="http://www.microsoft.com/security/portal/Threat/Encyclopedia/Entry.aspx?name=Trojan%3aWin32%2fTibs.IT&threatid=2147618655">Win32/Tibs!IT</a>. The 3rd program was not recognized, so I used the Microsoft’s <a href="https://www.microsoft.com/security/portal/Submission/Submit.aspx">Virus Submission Sample Page</a> to submit rmIhrYfwFjUdy.exe for further analysis. <br />
The trojan left more traces on my computer:<br />
- The "Smart HDD" shortcut on desktop pointing to QFUDzzwTiL1aQy.<br />
- A “Smart HDD” program group with 2 entries, one masquerading as an “Uninstall” program, but pointing to the same malware.<br />
- Most folders and files were hidden. I had to run recursive ‘attrib –h’ of my own to reset attributes. <br />
- The StartMenu and Taskbar settings were all changed. All the icons in start menus were hidden, the taskbar was set with Vista-like settings (program buttons with texts, no grouping, system tray showing all icons, etc). I had to go to Properties and explicitly set or reset all to defaults.<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhne2dJms4616lvCNqziUqaoKKwmf7zTYUysWqSItYhgO7iozn3Etxu-ZBxxxnLF8F_GtcxV7WdsBghBd89EwsCySPhrneKWOLDX5cBW2g1MM6DGDazd2rEG0VqpXQh9H2rrc7LpPLLoxs/s1600-h/Startmenu%25255B3%25255D.png"><img alt="Startmenu" border="0" height="381" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZWxPJVQgNYMKSwiTc-tyezRf_xE-BvWBkBEtbXCwCKzqrVIgyDz62fOpLAI6VwMDTou7__n3h00A_kRu4p9322eUNOewRh0jP5YVmHb_Ro6N_Yj1eFaLVw0_iHJC2VhE_KCc1RoK_RIc/?imgmax=800" style="background-image: none; border: 0px currentColor; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="Startmenu" width="316" /></a><br />
- All icons under “Administrative Tools” were deleted. In fact, the whole “C:\ProgramData\Microsoft\Windows\Start Menu” folder was cleaned of all files.<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCiUZWfZbsQpMRCGnNEewdzGyO__P70XcfteGpB_qBmVSFmk50BmztdRFGDrkaZK3EzsD11nzL24Y8iCQBR9NGvqYVKETgdxFGWA4kKGBWYC9VTBMAsQcS38GG5T6DehMYSIGvmJBHDkE/s1600-h/AdminTools%25255B3%25255D.png"><img alt="AdminTools" border="0" height="234" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS6-ZN_Z90N3GM2MxrkLf2taKRXfHxYYTYPOGlzdbjN23CDsBbn5UfNiL1rCaCZxeOfhfsuoH11geEfw7tGbZyjKI_1L7vIEn_7Q4vAhF8utGd5Y03ZHPSWcCpNLbz9erjJxLNPUuNiSc/?imgmax=800" style="background-image: none; border: 0px currentColor; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="AdminTools" width="443" /></a><br />
- The “C:\Users\All Users” folder is also gone. There may be other effects I haven’t found yet…<br />
Basically I’ve lost all the shortcuts/icons of all installed programs, but I’m still pleased I caught it in time before it caused more damage - the situation could have been much worse…<br />
In any case, this was one more win for Sysinternals tools.Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com15tag:blogger.com,1999:blog-7306978581108695483.post-36811532489159335002013-11-24T23:31:00.001-08:002013-12-11T10:03:41.498-08:00Using color themes with Visual Studio 2013 Express EditionsMicrosoft has recently released <a href="http://www.visualstudio.com/downloads/download-visual-studio-vs">Visual Studio 2013</a> and Matthew Johnson has released a new version of the <a href="http://visualstudiogallery.msdn.microsoft.com/9e08e5d3-6eb4-4e73-a045-6ea2a5cbdabe">Visual Studio 2013 Color Theme Editor</a>. Unfortunately it doesn’t support (yet?) the Express editions of VS2013. <br />
My previous article about <a href="http://alinconstantin.blogspot.com/2012/09/using-color-themes-with-visual-studio.html">using color themes with Visual Studio 2012</a> seemed to have been quite popular, it’s the most accessed article on my blog... Therefore, to continue the tradition, here is how to install the new theme colors available with Matt’s extension to work with the Visual Studio 2013 Express.<br />
1) First, download the zip file <a href="http://www.alinconstantin.net/download/VS2013Themes.zip">http://www.alinconstantin.net/download/VS2013Themes.zip</a> – it contains the 8 pkgdef files defining the colors of the 8 new themes from Matt’s extension, plus the 9th pkgdef with the theme names.<br />
<strong>Note</strong>: If you get errors when you try downloading the file, rest assured the file is still there on my home server. It’s likely a temporary problem with my Internet connection or the DNS servers, so try again later. (I’d also appreciate a warning mail if I don’t notice the problem myself and it doesn’t get resolved in 1 day)<br />
2) Create a folder (say named “Themes”) and unpack the zip file in that folder. The location of the folder depends on the Express edition you’re using. E.g. create the folder under this path:<br />
<table border="0" cellpadding="2" cellspacing="0" style="width: 719px;"><tbody>
<tr> <td valign="top" width="153"><strong>Express for Windows Desktop</strong></td> <td valign="top" width="564">%ProgramFiles%\Microsoft Visual Studio 12.0\Common7\IDE\WDExpressExtensions</td> </tr>
<tr> <td valign="top" width="153"><strong>Express for Windows</strong></td> <td valign="top" width="564">%ProgramFiles%\Microsoft Visual Studio 12.0\Common7\IDE\VSWinExpressExtensions</td> </tr>
<tr> <td valign="top" width="153"><strong>Express for Web</strong></td> <td valign="top" width="564">%ProgramFiles%\Microsoft Visual Studio 12.0\Common7\IDE\VWDExpressExtensions</td> </tr>
</tbody></table>
<strong></strong><br />
<strong>Note</strong>: If running on a 64-bit machine, instead of %ProgramFiles% use %ProgramFiles(x86)% because Visual Studio is a 32-bit process.<br />
<strong>Note 2</strong>: Visual Studio Express for Windows Phone was not released for 2013. If you need to colorize Express for Windows Phone 2012, see the <a href="http://alinconstantin.blogspot.com/2012/09/using-color-themes-with-visual-studio.html" title="Using color themes with Visual Studio 2012 Express Editions">Using color themes with Visual Studio 2012 Express Editions</a> article.<br />
<a href="http://lh4.ggpht.com/-58hgbvUHc2w/UpL8x6bS9TI/AAAAAAAAAd0/ptIKV7J8qpw/s1600-h/image%25255B6%25255D.png"><img alt="image" border="0" height="365" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqIbRChrTeuklZSJ0-Uo3wLNqgLXZTwOigdEe4NFjlM383UxYIPecVDACNoxakOFIXuEy77bZThuPpOpDbPqKRycoA8XUoGXP0E31nVVoKugSwAyxulq2MsJPraPdOTD33sbA84m7qo6U/?imgmax=800" style="background-image: none; border: 0px currentColor; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="1023" /></a><br />
3) Open a “Developer Command Prompt for VS2013”. When using Windows 8, search for “Visual Studio tools” and open the folder found. Visual Studio 2013 no longer installs the tools shortcuts directly in the Start Menu to avoid polluting the menu with 9+ rarely used shortcuts.<br />
<a href="http://lh3.ggpht.com/-xCXG_62o3Ew/UpL8ytmanCI/AAAAAAAAAeA/M-Mqi3zkjc4/s1600-h/image%25255B10%25255D.png"><img alt="image" border="0" height="330" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq3wszHL5vphYESB8TmToE6-lx_7j1Wd_AWNH6g01glOmi5ZTKRlClxpTfRf9YjF5j8-dfiYbA3Knz8JjgxOHWN5H5L2qWohNNrxdFXFl4kFHtGottNWFVx7qp5omrysTkwCeeU78CUB4/?imgmax=800" style="background-image: none; border: 0px currentColor; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="347" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJxbiQOorSgQR3lGKlg4W6m5Lxl4PSM6SHohzMwiddRAtGq8N_5DHmtWWEnqobgo00k9IpDKrsgFVnKJw3yTbsdjnIZ1IC-jC-w-YzRlR6Oks1nin4oj1h0497V2q00d9DPnXdNPEYEdM/s1600-h/image%25255B19%25255D.png"><img alt="image" border="0" height="223" src="http://lh5.ggpht.com/-QNB0HMc-afQ/UpL8z3D_e7I/AAAAAAAAAeY/pKa_iqnE6B4/image_thumb%25255B11%25255D.png?imgmax=800" style="background-image: none; border: 0px currentColor; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="821" /></a><br />
Anyway, once there type the command forcing VS Express to re-read the extensions settings. <br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZWYQnaA47lJXDVk2g0jNoZ3xl3i1Bsi8YSenku7pbE3jo0vE_d8ujIeKg0sISls_kk8G89G3wwl1w3EfLGXHUk8_WjWuTSbznL05ZWa0b1_clbDP8jy2lGc8mjvw673zJoTT1l5yD-yo/s1600-h/image%25255B14%25255D.png"><img alt="image" border="0" height="119" src="http://lh6.ggpht.com/-qavxWDRzcU4/UpL80kLF7yI/AAAAAAAAAeo/FpPcRTSgh7U/image_thumb%25255B8%25255D.png?imgmax=800" style="background-image: none; border: 0px currentColor; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="680" /></a><br />
Again, that depends on the version of Express used:<br />
<table border="0" cellpadding="2" cellspacing="0" style="width: 480px;"><tbody>
<tr> <td valign="top" width="229"><strong>Express for Windows Desktop</strong></td> <td valign="top" width="249">wdexpress.exe /updateconfiguration</td> </tr>
<tr> <td valign="top" width="229"><strong>Express for Windows</strong></td> <td valign="top" width="249">vswinexpress.exe /updateconfiguration</td> </tr>
<tr> <td valign="top" width="229"><strong>Express for Web</strong></td> <td valign="top" width="249">vwdexpress.exe /updateconfiguration</td> </tr>
</tbody></table>
<br />
4) Start VS Express and the themes should now be available in Tools/Options/Environment/General page.<br />
<a href="http://lh5.ggpht.com/-Q5KBxiQ2j48/UpL83LPm2lI/AAAAAAAAAe0/vYUBSrLi5Hg/s1600-h/image%25255B23%25255D.png"><img alt="image" border="0" height="677" src="http://lh5.ggpht.com/-uKSaDyA676k/UpL83kJIYVI/AAAAAAAAAe4/D37m-x5E-vE/image_thumb%25255B13%25255D.png?imgmax=800" style="background-image: none; border: 0px currentColor; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="929" /></a><br />
Should someone with a VS Professional/Ultimate install use Matt’s extension to create/edit a custom theme that you want to use on Express, that’s also possible. You will need a pkgdef file with the new theme, which you can get in two ways:<br />
<ul>
<li>On the machine with the VS install look under ‘%LocalAppData%\Microsoft\VisualStudio\12.0\Extensions’ folder. There should be some subfolders with random names, and one of them will contain a Colors.pkgdef file containing the theme of interest (open it with notepad and you should see in the beginning the theme’s name to confirm). Copy that file in the Themes folder created in step 2) above, rename it to give it a more appropriate name</li>
<li>Or, you can open the theme of interest in editor, and use the Export Theme button in the window's toolbar: <div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMHSzRTOwoHDEHbR68Q0zyLHN_PLjDzZlTVURnDaWSKxxko0iJNNAP6FC4rhZHJtEC6b6ymxwbfKRKAkiqke1KBLM4k9VCAozfII4RKY_l4SVhcVKL0_Ba-Z-tt2qkDewndJHV1X3j-EM/s1600/ExportTheme.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMHSzRTOwoHDEHbR68Q0zyLHN_PLjDzZlTVURnDaWSKxxko0iJNNAP6FC4rhZHJtEC6b6ymxwbfKRKAkiqke1KBLM4k9VCAozfII4RKY_l4SVhcVKL0_Ba-Z-tt2qkDewndJHV1X3j-EM/s1600/ExportTheme.png" /></a> </div>
<div class="separator" style="clear: both; text-align: left;">
In the FileSave dialog, make sure to set the file type to .PkgDef (by default the extension saves the file as .VsTheme), like this:
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOK5INY_vOO92uCnfptrZzyT8buJG1YIGUnq2XzIxebp8MKitA08qWOxjZzcz59Yl9MXDCoF0wYzxQ1z5K10imnii-heGNX-pPaBA8XkiyCFhFyitpxdNU2HY9oBuWPDnh0gJ7rGwFeL0/s1600/ExportThemeAsPkgdef.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOK5INY_vOO92uCnfptrZzyT8buJG1YIGUnq2XzIxebp8MKitA08qWOxjZzcz59Yl9MXDCoF0wYzxQ1z5K10imnii-heGNX-pPaBA8XkiyCFhFyitpxdNU2HY9oBuWPDnh0gJ7rGwFeL0/s1600/ExportThemeAsPkgdef.png" /></a>
After exporting the file, copy it in the Themes folder created in step 2) above in your VS Express installation.</div>
</li>
</ul>
Now you can repeat steps 3-4) above to force VS Express read the new extension pkgdef file, and you should be able to use the new custom theme in Tools/Options dialog.Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com28tag:blogger.com,1999:blog-7306978581108695483.post-66302973577821363652012-11-23T14:54:00.003-08:002012-11-23T14:54:20.796-08:00Links to my website are brokenIt's probably time to change my DNS registrar... I'm using dotster.com (old namezero.com) for my websites (<a href="http://alinconstantin.com/">http://alinconstantin.com</a> / <a href="http://alinconstantin.net/">http://alinconstantin.net</a> ), and I just discovered the sites were not forwarding anymore URLs to the dynamic DNS <a href="http://alinconstantin.dtdns.net/">http://alinconstantin.dtdns.net</a> and <a href="http://alinconstantin.homeip.net/">http://alinconstantin.homeip.net</a> . For some reason, they decided to change the domain from 'URL forwarding' to 'Parked' which pointed to a page with spam links.<br />
I changed that and now the root of the website redirects correctly, but folders and direct page links are still broken, they display some 'page not found' frame with the same spam links instead of redirecting to the matching folder on the dtdns.net site.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAhv_hbKtx9vTzfHaqouCQ1B9YAhFMKI61LS0Cq-GMRGL3-YohQQfyFvOodpfQWKPlLuhS2pkkd_Pp_zXNqg0nFwUnxMKfe72O0yYlv_JSG53CvkSV3veZAOeOG2rP_y7YNT3eQ01fzQk/s1600/pagenotfound.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="190" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAhv_hbKtx9vTzfHaqouCQ1B9YAhFMKI61LS0Cq-GMRGL3-YohQQfyFvOodpfQWKPlLuhS2pkkd_Pp_zXNqg0nFwUnxMKfe72O0yYlv_JSG53CvkSV3veZAOeOG2rP_y7YNT3eQ01fzQk/s320/pagenotfound.png" width="320" /></a></div>
<br />
I hope this is not some 'feature' added to get more spam clicks from others' domains. If the situation persists, it will be bye-bye namezero/dotster after 10 years of using their services...<br />
<br />
Meanwhile, if you can't access direct links to my website, use instead the dynamic DNS addresses I mentioned above.Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com1tag:blogger.com,1999:blog-7306978581108695483.post-81162252596319298972012-11-21T01:40:00.001-08:002012-11-21T01:40:30.864-08:00Using the Visual Studio’s Search Control<p>Visual Studio 2012 uses in a couple of windows a control that allows searching the window content. Examples are Quick Launch, tool windows like Toolbox/SolutionExplorer/ErrorList, etc.</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIh3251Sur9PAYEdfWf_7VDYvd3m1YBe1wwVP6UhNoaDp2JJqpoKQlex5RPF2cXQYfLSH2Jio0gFNiVYQk9l7oLyPm_PlSaQENmP-3yKStfRXkt3jiVw5IU8WeCJHEipqyVAnBCJZSlMQ/s1600-h/image%25255B13%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxpSw6H18j6dM3ci0exaqrhUEhovxWnJWIJVTluru5hBtTMHlyI3LGOoqMUDMB6wIinQF0QLRTJLXwv4nsE-BcxHBcyY9FsTzza73icbyMwhV-EgRSJiicZwCeb6zBt13G2LFqdyEBsIk/?imgmax=800" width="230" height="53" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjA5KcYw9Mug3J2GJIBPW-qKJ_iuW-1aqr_Fc92aGRq-RahAe2Xq9nza0Yfz63Pxuq0ThS0ORNs-e2uK7Tb7D4Ppma17goMY5FpRjV6KRsFMOKvvoDGhpbR5f8SrYj7U2WHoOvYSyThYvo/s1600-h/image%25255B3%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: block; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0SlDYHFxc9oG5XPOBQH-BlsgHJhiXasRvPBq5JwSqrOX_PHNeSZ6Lr2ru8PRzOVONMb0yvfq36aARbSiwCA_BoG8OMAQCji-KXuvUEjQ3Mza9EJTQKVRV1j_HEWM9aFEjsmcyUln_RzM/?imgmax=800" width="286" height="75" /></a></p> <p>The control can be easily reused in your package and added not only into Toolwindows, but to any piece of UI. This article will show you which interfaces to implement or call to implement a searchable dialog or toolwindow, from both native or managed code.</p> <h2><font color="#000000" size="2"><u>Too many search controls</u></font></h2> <p>Various windows in Visual Studio needed search capabilities, and without a common control to use, in time they have implemented their own solutions. Unfortunately, this leads to UI inconsistencies, usability problems and user confusion. In Visual Studio 2010 there were at least 15 different control implementations for the same purpose – simple search. Below are a couple examples of windows from Visual Studio 2012 that still use private implementations (hopefully in time they'll converge and use the common way)</p> <ul> <li> <div align="left"><span style="color: #1f497d"><font color="#000000">Minidump editor window (File/Open/File, pick a dmp file) allows searching in the modules list. Uses WPF edit/button, doesn't have a consistent start icon, no indication the list is filtered, etc.<img title="clip_image002" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: block; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image002" src="http://lh5.ggpht.com/-bWB0MKjpWsk/UKyhZPO8t2I/AAAAAAAAAZ4/P8t5Ds1_16o/clip_image002_thumb%25255B5%25255D.jpg?imgmax=800" width="278" height="71" v:shapes="Picture_x0020_1" /></font></span></div> </li> <li> <div align="left"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit6UenxoZnkaMXw73LzcT5uC2xS40k8fjLkE9GMo0zmaLlV6pU7eLk5xvlFZGx8dfCyLeG5OtkBFLnpKrg1nIJK60IU45_-5KLTLv8DwYX6umu2QeO-U1Z8F2rdrsF2Edhn6xGyCSfscY/s1600-h/clip_image002%25255B15%25255D.jpg"><span style="color: #1f497d"><font color="#000000">ClassView and ObjectBrowser put the search box in toolbar so use comboboxes and toolbar buttons. Clearing the search is done via a combo item.</font></span></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyTAMK5uLp_2mVaFYxv4Yrz9gQ8M3G-Ix7mD6XO1KPWDTWJYbt-26CqM0iniXeEft1STREqVXPJw7eUwqTIg4fezeE0FBwx3wM7nFrLetQlz7Mx0cfyOHQyhqYFHepiDMk3SaXVzQ9050/s1600-h/clip_image004%25255B31%25255D.jpg"><font color="#000000"><img title="clip_image004" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: block; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image004" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLKjF2KPj87yKZc2HIKgUlHoEdl5tqOafo7vK54ShdVQpztQmpbV_xh-P8Wk8DIKqAV27zac6QT7JBwSgo6rJSV9aVs1N_NH9AoKtq4Fcp670U4ksKWbV371tUd2-q2EryX8SQpt4DBxE/?imgmax=800" width="334" height="67" v:shapes="Picture_x0020_3" /></font></a><span style="color: #1f497d"></span></div> </li> <li> <div align="left"><span style="color: #1f497d"><span style="color: #1f497d"><font color="#000000">VC Project Property pages have an “All options” page that’s searchable yet their box is just an edit that doesn’t offer any indication search is performed.</font></span></span><span style="color: #1f497d"><span style="color: #1f497d"><font color="#000000"><a href="http://lh5.ggpht.com/-LIKnbm5al6Q/UKyha_n17KI/AAAAAAAAAaY/_ELxWctP0hg/s1600-h/clip_image006%25255B31%25255D.jpg"><img title="clip_image006" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: block; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image006" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaSRH0051tG7U2uQzvCEMa0-XwMwIFf5skdn40r7cPu9N5g92vDiU_mJbXW0cgbzb01no7ajw6FUfHS_-i3EGseiBwRHMTM6JtoRisNDUnFoLJlO9AvMEICsayqv_z2hiOE6YvICbisz8/?imgmax=800" width="633" height="60" v:shapes="Picture_x0020_2" /></a></font></span></span></div> </li> <li> <div align="left"><span style="color: #1f497d"><font color="#000000">TFS Shelvesets, Build Definitions use text box with watermark image (not a button), again there is no no way to easily clear a search</font></span><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFF5Yi0ufTT2o1oOS4cSnOuT-vK2aRCLbBh_GbZX4jOoo1llha8MeuXZmuztQlb7TSsvHlvNhKghL2-iXnSc3OF7DhZ0yS2AD85qILLTJRplRzyfyVqQ1W1so6sGJPxKxZm8Km8auadzU/s1600-h/clip_image008%25255B27%25255D.jpg"><font color="#000000"><img title="clip_image008" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: block; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image008" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_4SQeSZwCqZPQs2rNsWLT-3S3zlfTKAe47d_BlhWRyaBfuFc-a0qoj-g9rOawu4w3rtMdy3_hhu5pyB6zFvb4NcySbzzoHuT3byoA2Qg5Jatw9IlrX0KBCHww5arllIr4fOyTofq3tb8/?imgmax=800" width="352" height="55" v:shapes="Picture_x0020_4" /></font></a></div> </li> <li> <div align="left"><span style="color: #1f497d"><font color="#000000">Architecture Explorer uses comboboxes, require enter to start search, there is no other indication search is performed.</font></span><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixXAOqpDA7OK_CBygJuLchRWzaBgMjX0WjUxqoemb-6owSN7HjS4q-1jxYOdgvc8jGOthW-abRIPQQIiow9g8Ru9s50Yzq72a3NPqAc6kMWM8whDwq7h3VvjTCZK9spEnWDnpTLIhI4uw/s1600-h/clip_image010%25255B26%25255D.jpg"><font color="#000000"><img title="clip_image010" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: block; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image010" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1zmoAULdUfl-1juOpfSm-9Dsc5Bq4LmhEsgEExHtso2ngcK1kRcOQW3LK150JDCeZlEq_T6Ur7FCIRfZVbiM9hBdrQ0ZoqtXvHKcH5SawVnIyue6u-KbDIlB7LPClqYc9df10cMEiCN0/?imgmax=800" width="185" height="54" v:shapes="Picture_x0020_5" /></font></a></div> </li> </ul> <span style="color: #1f497d"></span> <p>If you’re consider adding search capabilities to a window in your package, please don’t perpetuate these inconsistencies and use the control provided by the shell team; if you find missing features or have suggestions for improvement, you can send mails to VS Shell team to consider including in next versions.</p> <p>Anyway, back to implementation.</p> <h2><font color="#000000" size="2"><u>Implementation considerations</u></font></h2> <p>The common search control in Visual Studio is implemented as a WPF control (the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.platformui.searchcontrol.aspx">Microsoft.VisualStudio.PlatformUI.SearchControl</a> class). Its data model set in DataContext property needs to be a Gel Microsoft.VisualStudio.Shell.Interop.<a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsuidatasource_methods.aspx">IVsUIDataSource</a> with specific properties/verb names; an example of such data source is the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.platformui.searchcontroldatasource.aspx">Microsoft.VisualStudio.PlatformUI.SearchControlDataSource</a> class. The control can be directly referenced from Xaml, however, to make it work you’d have to deal with data sources (setting the necessary properties when the verbs are invoked, e.g. setting search status ‘in progress’ when StartSearch verb is called, etc, because the UI binds directly to some of the data source properties), with <a href="http://msdn.microsoft.com/en-us/library/microsoft.internal.visualstudio.platformui.datasource.aspx">data source wrapper classes</a> that are marked internal, etc. It can be done (the editor team used it this way), but clearly that’s not the intended way to use the control.</p> <p>Instead, the control should be used through Visual Studio interfaces like IVsWindowSearch, IVsWindowSearchHost, IVsSearchTask, etc. Beside making the control accessible from native code (via COM), this abstracts you from the control implementation and let’s you focus only on setting up the search and performing the searches.</p> <h2><font color="#000000" size="2"><u>The GenerIC Case</u></font></h2> <p>In order to implement a searchable window, the owner needs to implement the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivswindowsearch.aspx">IVsWindowSearch</a> interface. </p> <p>To setup the search, you need to create first a search host. Query the SID_SVsWindowSearchHostFactory service from the shell, and call <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivswindowsearchhostfactory.createwindowsearchhost.aspx">IVsWindowSearchHostFactory.CreateWindowSearchHost</a>() function. Pass in as first argument an object identifying the control to be used as parent for the search control. The type of pParentControl argument depends on the UI technology used in your window, e.g. FrameworkElement for WPF, ElementHost for WinForms, or an object implementing IVsUIWin32Element/IVsUIWpfElement and returning the parent indirectly via <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsuiwin32element.gethandle.aspx">GetHandle</a>() or <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsuiwpfelement.getframeworkelement.aspx">GetFrameworkElement</a>() methods.</p> <p>Once you have the search host, call <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivswindowsearchhost.setupsearch.aspx">IVsWindowSearchHost.SetupSearch</a>() and pass in the object implementing IVsWindowSearch interface. There are a couple of things happening during this call:</p> <ul> <li>The shell creates the SearchControl WPF control child of the pParentControl specified during host creation</li> <li>The shell creates a settings data source and calls IVsWindowSearch.ProvideSearchSetting. Your window gets a chance to override the default values and influence the behavior of the search control (e.g. set a determinate progress type, or change the search to be instant or on-demand, disable MRU items and the popup, etc)</li> <li>The shell calls IVsWindowSearch.ProvideSearchFilters and ProvideSearchOptions to discover filter and options that will be shown (if necessary) in the search control’s popup</li> <li>The shell creates the necessary data sources and associates them with the search control.</li> <li>If the search control uses MRU items, the search control will use the SVsMRUItemsStore to store/retrieve the items under the IVsWindowSearchHost.Category guid. </li> </ul> <p>As the user types in the search control (default using delayed search start) and the search is started, the shell will call IVsWindowSearch.<a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivswindowsearch.createsearch.aspx">CreateSearch</a>() function. The shell parses the user input and creates an object implementing the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivssearchquery.aspx">IVsSearchQuery</a> interface (this allows for a consistent parsing of search strings into tokens, and identifying some tokens as filtering tokens). In response to the CreateSearch() call, the search control’s user needs to return an object implementing <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivssearchtask.aspx">IVsSearchTask</a>. The shell will then call IVsSearchTask.Start() from a background thread to perform the actual search job. Should the user click the X Stop button while the search is running, the Stop() function will be called on the UI thread on the search task. Should the user click the X Clear button after the search completes or is stopped, the shell will call IVsWindowSearch.<a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivswindowsearch.clearsearch.aspx">ClearSearch</a>()</p> <p>While the search is running, the search task is supposed to call IVsSearchCallback.<a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivssearchcallback.reportprogress.aspx">ReportProgress</a>() if the search control’s progress type was changed to SPT_DETERMINATE. When the search is complete, call <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivssearchcallback.reportcomplete.aspx">ReportComplete</a> to notify completion and the number of results found.</p> <p>When the search is no longer needed, one can call <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivswindowsearchhost.terminatesearch.aspx">IVsWindowSearchHost.TerminateSearch</a>() to release early the resources associated with the control, such as the data sources.</p> <p>Visual Studio also optimizes for the most common use case. To create a searchable toolwindow you don’t have to worry about setting up the search – instead, simply implement the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivswindowsearch.aspx">IVsWindowSearch</a> interface on the same class that implements the tool window pane (<a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivswindowpane.aspx">IVsWindowPane</a> or <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsuielementpane.aspx">IVsUIElementPane</a>), and the shell will take from you the burden of setting up the search and will provide a hosting place for the search control in the toolwindow frame area. Even more, classes in Managed Package Framework (MPF) from like Toolwindow already implement the necessary interfaces so you can simply make the search control appear in your window by overriding <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.toolwindowpane.searchenabled.aspx">SearchEnabled</a> property and return ‘true’.</p> <h2><font color="#000000" size="2"><u>The Search control in managed toolwindows, with shell hosting</u></font></h2> <p>Visual Studio SDK Contains a <a class="resultTitleLink" href="http://msdn.microsoft.com/en-us/library/hh266761.aspx" data-refinementid="117" data-index="0"><u><font color="#0066cc">Walkthrough: Adding Search to a Tool Window</font></u></a> article which has step-by-step instructions for using the search control in a managed toolwindow. The control is hosted by the shell in the toolwindow frame area, so you don’t need to worry about setting up the search (just override SearchEnabled property). The search-control in the searchable toolwindow from the article supports most recently used (MRU) items, search filters and options, and looks like like this:</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA47EMsvLGEyBkAb1Mj22gKA9JyplJI0ehx0wuchpwnNayHZUsHl_Kl73gpD5vZsWO1AXw23CWFthX6dpQ_6cKkjwonPO7v37ZN6jcX2dqF0zIzZMunoEwSFwvtmcJUEosubCWzQHftK4/s1600-h/SearchableToolWindow%25255B3%25255D.png"><img title="SearchableToolWindow" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="SearchableToolWindow" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMnWpQbbC4BjPiFSeVxKafO_EboISLSLHZttNekGsyQjedaL01rU5QCQcxZ-CqvWcCK5d1Ov4Xak1BID21a0Z-kqaExd2cromF6_mTLHlNu81lofUyxQTvivvPf_SyPs7r_gJsgl6E5L8/?imgmax=800" width="339" height="302" /></a></p> <p>Because the article doesn’t link to a downloadable end-to-end solution that you can try right a way, I’ve made available on my website the sample built from the articles instructions. You can download it from <a href="http://alinconstantin.net/download/Example.TestToolWindowSearch.zip">Example.TestToolWindowSearch.zip</a></p> <p> </p> <h2><font color="#000000" size="2"><u>The Search control in managed dialogs</u></font></h2> <p><font color="#000000">The <a href="http://alinconstantin.net/download/Example.SearchControlCS.zip">Example.SearchControlCS.zip</a> sample demonstrates using the search control from a managed dialog. When built, the sample’s package adds 2 menu items in Tools menu (‘Searchable WinForms dialog’/’Searchable WPF dialog’).</font></p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfNW0O-VKWRxKI2W-qqzWcFUreYNrfr0-YzQeXbnH65VyNEvGevOP8wD9xFu58kdhIA1s8K8ApyT3P3tXz_hq6RUSuHqWOHS-bLZjrYL4LtTourgfPv8XJdCosc5zxLNhmFSXx32u7Xy8/s1600-h/SearchableWindows%25255B7%25255D.png"><img title="SearchableWindows" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="SearchableWindows" src="http://lh5.ggpht.com/-v9NbQBSNv3k/UKyhe4zVPdI/AAAAAAAAAbc/MUGd-GBu4BE/SearchableWindows_thumb%25255B3%25255D.png?imgmax=800" width="385" height="103" /></a></p> <p>Both dialogs set up a search control and implement similar search capabilities – filter a list of fruits with names read from resources.</p> <p><font color="#000000"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnM84QFJ74CXT6sY8EZK6X3oITwxsRgvESKYmtKELcFKJsuaSPNuCCo-bM83GhaRj7YlDIRs0EpLFNBkxao7Nq_xD7kDvzlyevz8cZJzrjCPAleANuODF6Y0ideOZXk7GWCDi6nTKUtbM/s1600-h/SearchControlWinForms%25255B7%25255D.png"><img title="SearchControlWinForms" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="SearchControlWinForms" src="http://lh4.ggpht.com/-zUVMIheY8tM/UKyhf0sghOI/AAAAAAAAAbs/AG7G3zumB3A/SearchControlWinForms_thumb%25255B5%25255D.png?imgmax=800" width="452" height="306" /></a><a href="http://lh4.ggpht.com/-nl4ZiNX9IIo/UKyhga7SdDI/AAAAAAAAAb4/sC8lsPGs-XY/s1600-h/SearchControlWPF%25255B3%25255D.png"><img title="SearchControlWPF" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="SearchControlWPF" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbw6tejEtlUkbfV0SZNyafg_gZqJL0byILhq_Be4lP3WQlWqZzURS1kiklcDyxMmcZGCT4gVP_UO3PRAJVdRXgjcZf69aIDfkIe2RgDr_yi73prZpkJQ_UYYKuK_CnMR937fupG6fpdlw/?imgmax=800" width="304" height="304" /></a> </font></p> <p>To setup the search, one needs to define a container control that will act as parent for the search control and call <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivswindowsearchhostfactory.createwindowsearchhost.aspx">IVsWindowSearchHostFactory.CreateWindowSearchHost</a> with that container. For WinForms, the most ‘natural’ container choice type is <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.elementhost.aspx">ElementHost</a>, which ensures WinForms-WPF interoperability. For WPF, just pass in any <a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.aspx">FrameworkElement</a> (e.g. Grid, Border, etc) and the search control will be added as Child of that element.</p> <p>The two searchable dialogs are implemented in SearchableForm.cs and SearchableWpfWindow.xaml respectively.</p> <p>In this example there is only one search control per dialog (and the dialogs are ref counted being managed objects), so it’s easier to just implement the IVsWindowSearch interface directly on the dialogs. Should you need to use more search controls in a dialog you’ll have to create separate objects implementing IVsWindowSearch and pass them to IVsWindowSearchHost.SetupSearch when you create the search controls.</p> <p>Because I implemented the same kind of search in both dialogs, I was able to reuse the search task class SearchableWindowSearchTask. It derives from <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.vssearchtask.aspx">VsSearchTask</a> class in MPF and does the real search by overriding OnStartSearch method. It compares the typed user strings (from tokens of the search query) with the known fruits read from resources. The results are added to UI via 2 callback methods, clearResultsCallback and addResultCallback passed in constructor of the search task; this way the class can be used to report the results in both a WinForms ListBox or add them to an ObservableCollection bound to by the WPF dialog’s ListBox.</p> <p>The OnStopSearch() function on the search task is called by the search control on the UI threads; the base class sets the TaskStatus to Stopped and reports completion so there isn’t need to override this function.</p> <p>The OnSearchStart() function on the search task is called from background threads. This allows performing the actual search job asynchronously and you’d have to get out of your way to block the UI. The search task uses ThreadHelper.Generic.BeginInvoke() to call the UI update callbacks (because WinForms controls can only be accessed on the UI thread that created them, and also ObservableCollections can’t be modified from more than one thread). To make sure the results are not added to the UI by these callbacks after a search is canceled and the task is stopped, the code needs to recheck the value of TaskStatus on the UI thread before calling the callbacks.</p> <p>There are a few things necessary mentioning when using the search control in a dialog:</p> <ul> <li>By default, the search control uses a color scheme that follows the active theme in Visual Studio (e.g. Light/Dark). A dialog usually does not follow the theme colors, and to avoid having a black search control in a light dialog you’d probably want to set <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.platformui.searchsettingsdatasource.usedefaultthemecolors.aspx">UseDefaultThemeColors</a> property in the data source to False, and the control will use a the default color scheme regardless of the current theme.  There is a Utilities class in the <font size="2" face="Consolas"><font size="2" face="Consolas">Microsoft.Internal.VisualStudio.PlatformUI </font></font>namespace that allows easier interaction with Gel data sources:  <font size="2" face="Consolas"><font size="2" face="Consolas">Utilities.SetValue(pSearchSettings, </font></font><font color="#2b91af" size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas">SearchSettingsDataSource</font></font></font><font size="2" face="Consolas"><font size="2" face="Consolas">.</font></font><font color="#2b91af" size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas">PropertyNames</font></font></font><font size="2" face="Consolas"><font size="2" face="Consolas">.UseDefaultThemeColors, </font></font><font color="#0000ff" size="2" face="Consolas"><font color="#0000ff" size="2" face="Consolas"><font color="#0000ff" size="2" face="Consolas">false</font></font></font><font size="2" face="Consolas"><font size="2" face="Consolas">);</font></font></li> </ul> <font size="2" face="Consolas"><font size="2" face="Consolas"> <ul> <li><font face="Georgia">The search control uses data source properties that allows it to resize between Min/Max values (default 100/400). The control’s width will probably not fit by default all the parent container’s width, so you’ll need to set a larger <font size="2" face="Consolas"><font size="2" face="Consolas">ControlMaxWidth <font face="Georgia">value to make sure the control will stretch to all available space from parent. E.g. use the dialog’s width</font></font></font></font>: <font size="2" face="Consolas"><font size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas">Utilities</font></font></font><font size="2" face="Consolas"><font color="#000000" size="2" face="Consolas">.SetValue(pSearchSettings, </font></font><font color="#2b91af" size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas">SearchSettingsDataSource</font></font></font><font size="2" face="Consolas"><font color="#000000" size="2" face="Consolas">.</font></font><font color="#2b91af" size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas">PropertyNames</font></font></font><font size="2" face="Consolas"><font color="#000000" size="2" face="Consolas">.ControlMaxWidth, (</font></font><font color="#0000ff" size="2" face="Consolas"><font color="#0000ff" size="2" face="Consolas"><font color="#0000ff" size="2" face="Consolas">uint</font></font></font><font size="2" face="Consolas"><font color="#000000" size="2" face="Consolas">)</font></font><font color="#0000ff" size="2" face="Consolas"><font color="#0000ff" size="2" face="Consolas"><font color="#0000ff" size="2" face="Consolas">this</font></font></font><font size="2" face="Consolas"><font size="2" face="Consolas"><font color="#000000">.Width)</font></font></font></font></font><font size="2" face="Consolas"><font size="2" face="Consolas">;</font></font></li> </ul> <h2><font color="#000000" size="2"><u></u></font></h2> <h2><font color="#000000" size="2"><u>Managed Vs. Native Windows</u></font></h2> <p><font face="Georgia">If you have the choice in your window that needs to use search, go with managed implementation. Using the search control from managed code is simpler, as there are a lot of helper functions and classes in Managed Package Framework that helps you with the implementation.</font></p> <ul> <li><font face="Georgia">The <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.toolwindowpane.aspx">ToolWindowPane</a> class already implements IVsWindowSearch interface, so if your toolwindow derives from this you can quickly made a toolwindow searchable by overriding SearchEnabled=true.</font></li> <li><font face="Georgia">The <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.vssearchtask.aspx">VsSearchTask</a> class can be used as a base class for your search task, to implement the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivssearchtask.aspx">IVsSearchTask</a> members and let you focus on the actual search (derive from it and override OnStartSearch)</font></li> <li><font face="Georgia">Classes like <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.platformui.windowsearchbooleanoption.aspx">WindowSearchBooleanOption</a> and <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.platformui.windowsearchcommandoption.aspx">WindowSearchCommandOption</a> in Microsoft.VisualStudio.PlatformUI namespace allow to easily define search options (shown in the search control’s popup as checkboxes or links). The <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.platformui.windowsearchoptionenumerator.aspx">WindowSearchOptionEnumerator</a> class can be used to return a VS-style enumerator over IEnumerable list of search options to be easily returned from IVsWindowSearch.ProvideSearchOptions.</font></li> <li><font face="Georgia">The </font><font face="Georgia"><a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.platformui.windowsearchsimplefilter.aspx">WindowSearchSimpleFilter</a></font><font face="Georgia"> class allows implementing a search filter (shown in popup as a button) by specifying just the name and filter field. For </font><font face="Georgia"> more advanced filtering derive from <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.platformui.windowsearchcustomfilter.aspx">WindowSearchCustomFilter</a> class. The <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.platformui.windowsearchfilterenumerator.aspx">WindowSearchFilterEnumerator</a> </font><font face="Georgia">class can be used to return a VS-style enumerator over IEnumerable list of search filters to be easily returned from IVsWindowSearch.ProvideSearchFilters.</font></li> <li><font face="Georgia">There are function like SetValue/GetTypedValue in Microsoft.Internal.VisualStudio.PlatformUI.<a href="http://msdn.microsoft.com/en-us/library/microsoft.internal.visualstudio.platformui.utilities.aspx">Utilities</a> class that allow providing search control’s settings in the data source without having to deal with IVsUIObjects</font></li> <li><font face="Georgia">There is another utility class, Microsoft.VisualStudio.PlatformUI.<a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.platformui.searchutilities_methods.aspx">SearchUtilities</a> that has methods for creating search queries (IVsSearchQuery) or search tokens from strings, parsing search queries into tokens, etc.</font></li> </ul> <p><font face="Georgia">If you choose for a native implementation, you’d have to deal with all the above yourself. You’d have to create your own COM classes even for something simple like changing search control’s setting. In the examples below I’ll give you some sample implementations for IVsUIObjects, IVsSearchTask, IVsWindowSearch, if you have to use filters or options you’d have write your own classes. </font></p> <p><font face="Georgia">In addition, using the search control in a native dialog requires more code to write to ensure Win32-WPF keyboard interoperability and there are also some bugs (more on this later).</font></p> <p><font face="Georgia"></font></p> <h2><font color="#000000" size="2"><u>The Search control in NATIVE TOOLWINDOWS aND DIALOGS</u></font></h2> <p><font color="#000000"><font face="Georgia">The </font><a href="http://alinconstantin.net/download/Example.SearchControlCpp.zip">Example.SearchControlCpp.zip</a><font face="Georgia"></font><font face="Georgia"> sample demonstrates using the search control from a native toolwindow and dialog. When built, the sample’s package adds 2 menu items in Tools menu (‘Searchable Native Dialog’/’Searchable Native Toolwindow’).</font></font></p> </font></font> <p><a href="http://lh5.ggpht.com/-QsGTL3qwHY8/UKyhhfkLygI/AAAAAAAAAcI/K1_31bnhHHI/s1600-h/SearchableWindowsNative%25255B3%25255D.png"><img title="SearchableWindowsNative" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="SearchableWindowsNative" src="http://lh4.ggpht.com/-jfe8BTHbE1M/UKyhhw3sKnI/AAAAAAAAAcQ/N9GQsDjofD8/SearchableWindowsNative_thumb%25255B1%25255D.png?imgmax=800" width="385" height="124" /></a></p> <p>The two menu commands display a dialog and a toolwindow like these:</p> <p><a href="http://lh3.ggpht.com/-pcW8ZvT70Is/UKyhiVl5dPI/AAAAAAAAAcY/NRQLUbovJg8/s1600-h/SearchControlNativeDialog%25255B3%25255D.png"><img title="SearchControlNativeDialog" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="SearchControlNativeDialog" src="http://lh5.ggpht.com/-SuVTYRIVzZU/UKyhiw0V9mI/AAAAAAAAAcg/l6yODlwRJjI/SearchControlNativeDialog_thumb%25255B1%25255D.png?imgmax=800" width="424" height="344" /></a></p> <p><a href="http://lh3.ggpht.com/-D23RqwuIAP8/UKyhjHgaq2I/AAAAAAAAAco/nso21Jh-_zc/s1600-h/SearchControlNativeToolwindow%25255B3%25255D.png"><img title="SearchControlNativeToolwindow" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="SearchControlNativeToolwindow" src="http://lh3.ggpht.com/-BkJZ59AAMT8/UKyhjQkFlEI/AAAAAAAAAcw/04ecByk927I/SearchControlNativeToolwindow_thumb%25255B1%25255D.png?imgmax=800" width="391" height="329" /></a></p> <p>To use a Win32 window as the search control’s parent, one needs to pass in an object implementing <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsuiwin32element.aspx">IVsUIWin32Element</a> interface and returning the HWND of the parent window from the GetHandle() function. The class CWin32Element does exactly that. The sample uses a Static Win32 control for the search control’s parent.</p> <p>For both dialog and toolwindow (in SearchControlCppWindowPane and SearchControlCppDialog), the search is setup from OnInitDialog() function that is a handler for dialog’s creation message WM_INITDIALOG. </p> <p>As mentioned above, there is no help from the native VSL (Visual Studio Template Library in SDK) on dealing with the search interfaces. The example defines its own COM classes CMyDialogWindowSearch (implementing IVsWindowSearch), CMySearchTask (implementing IVsSearchTask). If you need to use filters or options with the search control you’d also need to create your own classes implementing IVsWindowSearchSimpleFilter, IVsWindowSearchCustomFilter, IVsWindowSearchBooleanOption, IVsWindowSearchCommandOption and the enumerators IVsEnumWindowSearchFilters, IVsEnumWindowSearchOptions.</p> <p>Also, in providing search control settings (e.g. for setting the search type to instant search), you’d have to pass in property values which are objects implementing <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsuiobject.aspx">IVsUIObject</a> interface. In the sample I’m defining a class CVsUIBuiltInPropertyValue that can be used to create values for built-in Gel data types (int, strings, booleans, etc) and a couple of functions like Gel::CreateBuiltInValue to easily create such property values.</p> <p>The 2 properties mentioned above for using the search control in managed dialogs (UseDefaultThemeColors and <font size="2" face="Consolas"><font size="2" face="Consolas">ControlMaxWidth</font></font>) will need to be set for native dialogs, too. In addition, there are a couple of gotchas for using the search control in a native dialog:</p> <ul> <li>To ensure the Win32 dialog forwards keyboard input to the WPF control, the HwndSource window created by the search host, child of the dialog needs to intercept the WM_GETDLGCODE message and return DLGC_WANTCHARS | DLGC_WANTTAB | DLGC_WANTARROWS | DLGC_WANTALLKEYS to indicate it wants to process keyboard input. The SearchControlHostProc is the subclass proc that does this.</li> <li>To ensure correct tabbing into the search control I’m subclassing the Static parent of the search control, intercepting WM_SETFOCUS messages and forwarding focus activation to the HwndSource child. WPF will further focus the SearchControl. The SearchControlParentProc is the subclassed window proc of the Static control.</li> <li>To ensure tabbing out the search control, I’m intercepting WM_CHAR(VK_TAB) on the HwndSource and focusing the next parent dialog’s control in tab order.</li> </ul> <p>All these could be done by the VS shell on your behalf, so hopefully in a future VS version these will no longer be necessary from the search implementer…</p> <p>And there is another problem you may have noticed in the screenshot above: if the height of the parent Static control is bigger than needed by the search control, a black band appears under the search box. This is a bug that will have to be fixed in VS side (set the background brush on the HwndSource at creation time).</p> <h2><font color="#000000" size="2"><u>Samples used in the article</u></font></h2> <ul> <li><a href="http://alinconstantin.net/download/Example.TestToolWindowSearch.zip">Example.TestToolWindowSearch.zip</a> demonstrates using the search control in managed toolwindow</li> <li><a href="http://alinconstantin.net/download/Example.SearchControlCS.zip">Example.SearchControlCS.zip</a> demonstrates using the search control in managed dialogs (WF and WPF)</li> <li><font color="#000000"><a href="http://alinconstantin.net/download/Example.SearchControlCpp.zip">Example.SearchControlCpp.zip</a><font face="Georgia"></font><font face="Georgia"> demonstrates using the search control in native dialogs and toolwindows</font></font></li> </ul> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com2tag:blogger.com,1999:blog-7306978581108695483.post-21746492186171957212012-09-14T00:06:00.001-07:002012-09-14T00:06:00.167-07:00Using color themes with Visual Studio 2012 Express Editions<p> </p> <p>Visual Studio 2012 ships out of the box with 2 color themes, <a href="http://blogs.msdn.com/b/visualstudio/archive/2012/05/08/visual-studio-11-user-interface-updates-coming-in-rc.aspx">Light</a> and <a href="http://blogs.msdn.com/b/visualstudio/archive/2012/05/29/visual-studio-dark-theme.aspx">Dark</a>. Many users have complained the Light theme is too gray, depressing and ugly, some went as far as to claim they’d commit suicide if they’d be forced to look a whole day to this UI.</p> <p>Personally I think that’s an exaggeration. However, while I absolutely like the Dark theme, and I could use the Light theme without problems, sometimes I’d prefer a bit more color. </p> <p>For Visual Studio 2012 Professional/Premium/Ultimate there is a free <a href="http://visualstudiogallery.msdn.microsoft.com/366ad100-0003-4c9a-81a8-337d4e7ace05">Visual Studio 2012 Color Theme Editor</a> extension that Matt Johnson wrote. It adds a couple color themes such as Red, Green, Blue, Purple, Tan, Dark with Light editor, Light with Dark editor. It also allows creating new themes, editing colors, etc.</p> <blockquote> <p><a href="http://visualstudiogallery.msdn.microsoft.com/366ad100-0003-4c9a-81a8-337d4e7ace05"><img title="screenshot" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="screenshot" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlef6yQFuDL2jgEzhiUqV1lfCiiQcms8Y41zZGf57f8SoG8cWls43P6AyAzok9TUyr9B64jVJCqOdDSq578_uMNyW3ERL_Qef0cPihCDFdNJavwuGnLF5PHJlFKBJkirIdbkibK2FOZ30/?imgmax=800" width="204" height="204" /></a> </p> </blockquote> <p>Unfortunately, the extension is not available for Express editions of Visual Studio (and usually Express editions don’t allow loading extensions). It seems like on Express you’d be forced to use only the Light/Dark themes… Well, that’s not true!</p> <p>Below I’ll tell you how to install the color themes on a Visual Studio 2012 Express, and I’ll exemplify with the newly released <a href="http://www.microsoft.com/visualstudio/eng/downloads#d-express-windows-desktop">Visual Studio Express for Windows Desktop</a>. </p> <p> </p> <p>1) First, download the zip file <a title="http://alinconstantin.net/download/VS2012Themes.zip" href="http://www.alinconstantin.net/download/VS2012Themes.zip">http://www.alinconstantin.net/download/VS2012Themes.zip</a> – it contains the 7 pkgdef files defining the colors of the default themes from Matt’s extension.</p> <p>2) Now, create a folder under "<font face="Courier New">%ProgramFiles%\Microsoft Visual Studio 11.0\Common7\IDE\WDExpressExtensions”</font>, and lets name it “<font face="Courier New">Themes</font>”. Unpack the zip file in that folder.</p> <p><a href="http://lh3.ggpht.com/-PlkFQhSODQ0/UFLXTskqZbI/AAAAAAAAAXI/YueoXWQUFBA/s1600-h/Pkgdefs%25255B7%25255D.png"><img title="Pkgdefs" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Pkgdefs" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAfQdaSdSWapV2QW_PcMrR2QJqq0ptacpr3-VXVdDdUEZtdJXvWV1L7w2Z15JcJ2KjwdurYgaA2z_j-X2vFp2uajEo-a3ixRGWu3cCVzeQp-1Srao_i0uteJfUHOZwbfwP39vFVV6aRi8/?imgmax=800" width="1039" height="289" /></a></p> <p>3) Open a ‘Developer Command Prompt for VS2012” window. In the command line, type “<font face="Courier New">wdexpress.exe /updateconfiguration</font>”. This will make Visual Studio to read the pkgdef files on next restart, and import the color themes into registry.</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibnhbFDsh_p4EyKbklr8FQASb2sIrUL26mR4gK5Al0hX3N743eysR3fTwn2nUgIt0ZSPkHTTaYcBD8RISAzVirMjnE5LFwWh2vkD2dOqP-eYgXN8kDMV-GmauPEgMALZrUtxqyN5u8tr8/s1600-h/wdexpressupdateconfig%25255B3%25255D.png"><img title="wdexpressupdateconfig" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="wdexpressupdateconfig" src="http://lh3.ggpht.com/-2gppAdyfqlU/UFLXU8UZ9iI/AAAAAAAAAXg/MNbIFz3lwx4/wdexpressupdateconfig_thumb%25255B1%25255D.png?imgmax=800" width="681" height="131" /></a></p> <p>4) Launch Visual Studio Express, and now you should be able to see the new themes and switch them in Tools/Options dialog, Environment/General tab</p> <p><a href="http://lh3.ggpht.com/-T-OS3wCnYLo/UFLXVcHH3ZI/AAAAAAAAAXo/HnaSLZybL8k/s1600-h/RedWDExpress%25255B4%25255D.png"><img title="RedWDExpress" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="RedWDExpress" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoY6xM7Ertd39DIjtKND-CfBVamgD7Dt_roEzG1Ci0_uEBsg44IUF98LwyH4abMH3YQCRAHS3M4QD5yG4fk1bzWiiIQHHemKGqiQ57ReoHTuSEIwGRZCwSHu0I1sPe78B8mRDoALyytMw/?imgmax=800" width="1028" height="644" /></a></p> <p> </p> <p>Should someone with a VS Professional/Ultimate install use Matt’s extension to create/edit a custom theme that you want to use on Express, that’s also possible. On the machine with the VS install look under ‘<font face="Courier New">%LocalAppData%\Microsoft\VisualStudio\11.0\Extensions</font>’ folder. There should be some subfolders with random names, and one of them will contain a <font face="Courier New">Colors.pkgdef</font> file containing the theme of interest (open it with notepad and you should see in the beginning the theme’s name to confirm). Copy that file in the WDExpressExtensions\Themes folder, rename it to give it a more appropriate name (repeat steps 2-4), and you should be able to use the new custom theme.</p> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com71tag:blogger.com,1999:blog-7306978581108695483.post-77607586215070079932012-08-31T20:34:00.001-07:002012-08-31T20:34:43.224-07:00Windows Live Mesh 2011 and Windows Essentials 2012<p>As you may know, Microsoft has replaced Windows Live Mesh from Windows Live Essentials 2011 with Microsoft </p> <p>SkyDrive in the updated Windows Essentials 2012. While SkyDrive offers new interesting sync functionality, it does not completely replace all the functionality you had with Windows Live Mesh. I used to have a folder shared with my parents and sister where we could easily exchange pictures just by dropping new files in a local folder and have the file appear on my parent’s computer without any action necessary from their part. While Skydrive can be used for sharing, it requires my parents to look on the web in my Skydrive folder and manually download new files. (Why, Microsoft this usability regression?) If you’re like me and miss the removed functionality, please spend a few minutes and <a href="https://feedback.live.com/default.aspx?productkey=wlfolders">give Microsoft feedback about SkyDrive</a>, if we’re many sending feedback hopefully Microsoft may reconsider the current decision.</p> <p>Anyway, while I like the updated functionality from MovieMaker, SkyDrive, etc, I still want to run Live Mesh. But upgrading to Windows Essentials 2012 (downloadable from <a title="Essentials installer files for Windows 7, Windows 8, and Windows Server 2008" href="http://windows.microsoft.com/en-US/windows-live/essentials-install-offline-faq#">Essentials installer files for Windows 7, Windows 8, and Windows Server 2008</a> section) will remove Windows Live Essentials 2011 (downloadable from <a title="Essentials installer files for Windows Vista" href="http://windows.microsoft.com/en-US/windows-live/essentials-install-offline-faq#">Essentials installer files for Windows Vista</a> section). And the later will not install if you have already installed/upgraded to the 2012 version. <img class="wlEmoticon wlEmoticon-sadsmile" style="border-top-style: none; border-left-style: none; border-bottom-style: none; border-right-style: none" alt="Sad smile" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_7PBksjNQszWail5nHJEe-RLw4JOJpvRiiXzItZg6WJlHAd_2c3x_JE319xUuXDc4YYI5h58y1GHGPWAq67pWITshP6N1ehxkIFMblzL6D_iexSVyrwf3sySB4FvVMVS0JIanvkqmq3I/?imgmax=800" /></p> <p>So, here is how to install Windows Live Mesh 2011 after installing Windows Essentials 2012:</p> <p>- open an elevated command prompt</p> <p>- cd %ProgramFiles%\Common Files\Windows Live\ (or “Program Files (x86)” on 64-bit OS-es)</p> <p>- make sure you exit any running Windows Live program (Messenger, Writer, etc)</p> <p>- “attrib –s –h .cache” to change the attributes of the .cache folder</p> <p>- delete the folder “rmdir /q/s .cache”</p> <p>- now you can run the wlsetup-all.exe from Windows Live Essentials 2011 (download links above) and it won’t complain anymore about the newer version installed.</p> <p>I got the idea after finding Jonathan’s blog, where he made available for download a <strong>Live Mesh Installer </strong>tool: <a title="http://messengergeek.wordpress.com/2012/08/09/installing-windows-live-mesh-2011-with-windows-essentials-2012/" href="http://messengergeek.wordpress.com/2012/08/09/installing-windows-live-mesh-2011-with-windows-essentials-2012/">http://messengergeek.wordpress.com/2012/08/09/installing-windows-live-mesh-2011-with-windows-essentials-2012/</a> The tool downloads WLE2011 web version and installs it even if you have 2012 version installed. It didn’t work for me (it failed to delete the .cache folder, I may have had WL programs running), but at least it pointed me in the right direction to which folder needs to be manually deleted to make things work. Thanks!</p> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com4tag:blogger.com,1999:blog-7306978581108695483.post-38741647893275300782012-08-30T17:20:00.001-07:002012-08-30T17:20:26.774-07:00Package-registered browsers/previewers in Visual Studio<p>Over the last months I’ve been asked twice how should a Visual Studio package register a new standard previewer that will show up in the BrowseWith… dialog. It turns out that MSDN <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsuishellopendocument.addstandardpreviewer(v=vs.110).aspx">documentation</a> is not very explicit about what’s possible and what’s not. Also, there are a couple of holes in Manage Packet Framework (MPF) that will need additional explanation to avoid them. So here’s this article and sample hoping to bring some light.</p> <p> <br />In Visual Studio, when you right click a html file in Solution Explorer and choose BrowseWith… you can access a dialog listing all system-installed browsers (auto-detected by Visual Studio), package-registered browsers or browsers added explicitly by the user.</p> <p><a href="http://lh6.ggpht.com/-8QoGjfcAMHk/UEADO1BqYII/AAAAAAAAAU4/UXgCEHAiKMQ/s1600-h/image3.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQaclHgzyQkzEzFvhZGuhBXsIEqEB1NZrHwOzfbmeJ5dmSv0W2NQAUqrP66cZArNoYago1GLL4QFakCFF9iRGb1xI5f39Q3yVd6HdJlq2kThSfMKv0MdU9udibSkpvoUOBmXcYCAUItW0/?imgmax=800" width="644" height="237" /></a></p> <p><a href="http://lh4.ggpht.com/-ug6Pbey1djE/UEADPV8mp6I/AAAAAAAAAVI/CFLoeoB6uug/s1600-h/image8.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5e7UgFWPYO_kSbkx8gjQGWNsg9xMw9NMQFEWzRx-3nljQ6tnx_v2rr0Q92I_dbrK4Xs8nZi_f3_Obpay8vRykUtNxY7z67fXKb1jZ4xM1l485yXTYXWR2x0W9MgBqx476-0PJGDsRnlM/?imgmax=800" width="475" height="362" /></a></p> <p><a href="http://lh4.ggpht.com/-g_g9COfLWWY/UEADQOfLbfI/AAAAAAAAAVY/Md2HCLnnzks/s1600-h/image12.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://lh5.ggpht.com/-ahrqEBNb6Rs/UEADQuryoWI/AAAAAAAAAVg/5vnpMFEKOLw/image_thumb6.png?imgmax=800" width="428" height="208" /></a></p> <p> <br />For user-registered browsers, in Visual Studio 2012 the “Add program” dialog has been changed to allow specifying explicitly program’s arguments, and the code has been changed to support saving and passing the arguments at the browser’s invocation time. (To some extent arguments could have been passed in VS2010 as well in the Program edit box, but that was not evident to the user, plus there were bugs that caused the arguments to be discarded in various situations).</p> <p> <br />Packages can also register browsers via the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.svsuishellopendocument.aspx">SVsUIShellOpenDocument</a> service. Here is how adding a new browser is supposed to work:</p> <p>1) the package should write a key under “Visual Studio\11.0\AddStandardPreviewer” with the package Guid. Unfortunately there is no RegistrationAttribute helper class in MPF that can be used to declare these keys, so you’d have to write your own.</p> <p>2) at the appropriate time, the environment parses the registry entries and calls <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivspackage.resetdefaults.aspx">ResetDefaults</a>, passing in a value of <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.__vspkgresetflags.aspx">PKGRF_ADDSTDPREVIEWER</a> for the grfFlags parameter on the VSPackage. Unfortunately, the Package class in MPF already implements ResetDefaults() and does not allow derived classes to override virtual functions for registering previewers.</p> <p>3) at that point the VSPackage should call <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsuishellopendocument.addstandardpreviewer(v=vs.110).aspx">IVsUIShellOpenDocument.AddStandardPreviewer</a>. The function however does not have an explicit argument for passing browser’s arguments (it only has ‘string pszExePath’ suggesting the browser’s executable and not the actual command line string), so it may not be clear this thing is possible/supported.</p> <p>To demonstrate how a package can register a browser, I wrote a sample, <a title="Example.BrowseWithExplorer.zip" href="http://www.alinconstantin.net/Download/Example.BrowseWithExplorer.zip">Example.BrowseWithExplorer.zip</a> that implements a package registering 2 browsers: Internet Explorer InPrivate (allowing InPrivate previewing of the file of interest) and Internet Explorer Kiosk (which opens the browser without toolbars, menus, status bar, tabs, etc. – to close the browser use Alt-F4). </p> <p> </p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDL0ZyNL8CdjStoQ9gIRq3f65ilXA2_Il7L6MB52R9zZmKi1AK6YG4P-ZUKGL1UrYO2YO7Ncj7MSW4mYlCGQOCNY7uxS_DyJp3HNZmLSljVfQKEDlUWzdPaosD5aSaNJMn3Gd8YCfkX5Y/s1600-h/Example.BrowseWithExplorer3.png"><img title="Example.BrowseWithExplorer" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Example.BrowseWithExplorer" src="http://lh6.ggpht.com/-vpyeNcZGJcs/UEADRK4ByNI/AAAAAAAAAVw/9Q0QI9a_5PU/Example.BrowseWithExplorer_thumb1.png?imgmax=800" width="475" height="362" /></a></p> <p>The sample defines a registration attribute, ProvideStandardPreviewerAttribute, that can be used on the package class to declare the package will register standard previewers. Hopefully, future versions of MPF will include such class so you won’t have to write your own.</p> <p><a href="http://lh5.ggpht.com/-YM9Ft7lEWNA/UEADRmGGstI/AAAAAAAAAV4/45F8DbqhHss/s1600-h/regprev3.png"><img title="regprev" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="regprev" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-FyiSUIq21okwcqgqCon527YpPfdirqyZZlLqYmiaiUBU9tfg-pgZBWamKtrKaNDGkMDujJoXBg1LqBGjicxTOfWqQcNsEnUrfRab-YosL_42kHplt4wueuU1_8iiiFqzCUFhfign6T8/?imgmax=800" width="875" height="106" /></a></p> <p>Then, the package will have to re-implement the IVsPackage interface as shown in the above picture, and re-implement the ResetDefaults method so it can intercept the calls with __VSPKGRESETFLAGS.PKGRF_ADDSTDPREVIEWER flag</p> <p><a href="http://lh4.ggpht.com/-96a_KWZrAio/UEADSM4HDVI/AAAAAAAAAWI/Mwr_2nP8jDA/s1600-h/image21.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg68tQiJVUAl7E51ufruNdlqYpQ1QPFUu4UnkPjh1O7DxLghkkDvi8-6tSCG4AyWkni6YOjI3tA9XrGku38CbYbbM4GIOALRR2vHjD-G_VQrQz48jcb8CsYvgfj86cJTHp6mOwQi5lco1Q/?imgmax=800" width="435" height="22" /></a></p> <p>As for the browser’s invocation, when registering a standard previewer, the first argument in the AddStandardPreviewer allows specifying command line arguments for the previewer in addition to the path to the browser's executable. If there are no quotes in the path, the whole string is assumed to be the full path to the binary exe file of the previewer. However, if the pszExePath string beings with a quote (quotes are used around the executable binary) then arguments can be added separated by a space from the quoted filename. </p> <p>%1, %URL or %url can be used in the arguments list, and Visual Studio will replace it at runtime with the name of the file to be previewed, (as a URL-formatted quoted string, e.g. "file:///C:/temp/My%20File.txt" ).  If the arguments don't contain either of %1, %URL, %url, then Visual Studio will append the file name to be previewed to the pszExePath string before launching the previewer process with that concatenated string as arguments. <br />Multiple previewers can be registered with the same executable path if the list of arguments passed are different.</p> <p>The 2 browsers registered by the sample invoke “IExplore.exe –k [filename]” for the Kiosk mode and “IExplore.exe –private [filename]” for InPrivate browsing, as described in <a title="http://msdn.microsoft.com/en-us/library/ee330728(v=VS.85).aspx" href="http://msdn.microsoft.com/en-us/library/ee330728(v=VS.85).aspx">Internet Explorer Command-Line Options</a> MSDN article. </p> <p> <br />And finally, a few words about the system browsers listed in the dialog. When the OpenWith… dialog is displayed, Visual Studio will try to detect the browsers installed on the system. These browsers cannot be deleted from the dialog (well, you can delete them but they will re-detected and will appear back next time the dialog is reopen, unless the browser has been uninstalled at that point). In order to detect system browsers, Visual Studio looks in a couple of known locations:</p> <p>- The shell\open\command for the ProgID associated with the http protocol for the current user or with the .htm files.</p> <p>- The Default value under HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\<em>[Executable.exe]</em> or HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\<em>[Executable.exe]</em></p> <p>- HKCR\Applications\<em>[Executable.exe]</em>\Shell\Open\Command, for a couple of known executable of browsers with highest market use share.</p> <p>- HKCU\SOFTWARE\Clients\StartMenuInternet and HKLM\SOFTWARE\Clients\StartMenuInternet, as described in this MSDN article <a href="http://msdn.microsoft.com/en-us/library/dd203067%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/dd203067%28VS.85%29.aspx</a></p> <p>Some browsers don’t write any version-independent registry values that can be used to locate their executable, hence they are not listed in the dialog unless they are also made the default system browser. Current examples of browsers with bad registration are SRWare Iron, Maxthon, Lynx. System browsers are encouraged to write their registration under StartMenuInternet so they can be detected by Visual Studio and Windows (and be listed in Windows’ Change Program Defaults dialogs as well).</p> <p> <br />The sample in this article can be downloaded from: <a href="http://www.alinconstantin.net/Download/Example.BrowseWithExplorer.zip">http://www.alinconstantin.net/Download/Example.BrowseWithExplorer.zip</a></p> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com0tag:blogger.com,1999:blog-7306978581108695483.post-25834086399868994682012-08-29T12:21:00.001-07:002012-08-29T12:21:04.520-07:00Notepad.exe command line arguments<p>I was looking for Notepad’s arguments for a sample I’m thinking of writing; I’ve searched the net and found some of these, and had to investigate a bit to find out about the others. I’m a bit surprised it only supports so few flags, I was expecting at least a “go to line” capability. Anyway, here they are:</p> <p><font size="3" face="Courier New"><strong>/A      Ansi:</strong> </font><strong>notepad /a file.txt</strong> Opens the specified file as Ansi (overrides encoding auto-detection)</p> <p><font face="Courier New"><font size="3"><strong>/W      Wide</strong>: </font></font><strong>notepad /w file.txt</strong> Opens the specified file as Unicode (overrides encoding auto-detection)</p> <p><font face="Courier New"><font size="3"><strong>/P      Print</strong>: </font></font><strong>notepad /p file.txt</strong> Opens the file, prints its content to the default printer and exit</p> <p><font face="Courier New"><font size="3"><strong>/PT     PrintTo</strong>: </font></font><strong>notepad /pt “file.txt” “<printername>”</strong> prints the file to the specified printer. Both the filename and the printer name have to be in quotes, regardless of the names containing spaces or not. E.g.: <strong>notepad /pt “file.txt” “Send To OneNote 2013” </strong>or <strong>notepad /pt “file.txt” “</strong><a href="file://\\Server\SharedPrinter"><strong>\\Server\SharedPrinter</strong></a><strong>”</strong></p> <p><font size="3" face="Courier New"><strong>/.SETUP SetupMode:</strong> </font>E.g. <strong>notepad /.setup file.txt</strong>.  I’m unclear what this is used for. It’s a weird mode, it does not repaint the window if it was started restored. You’d have to press Alt-Space and Maximize it to view the file content. The window has 2 sets of scrollbars in that case (one set is apparently unused), and it closes if Escape or Ctrl+D are pressed. Perhaps some setup programs invoke notepad with these arguments to display the EULA? Who knows.</p> <p> </p> <p>That being said, for a better small & fast replacement of notepad, I suggest using SaneStudio’s NitroLite, downloadable from <a title="http://sanestudios.com/n2.html" href="http://sanestudios.com/n2.html">http://sanestudios.com/n2.html</a>. No installation needed, at only ~100kb, it packs loads of features, syntax coloring, binary editor, etc.</p> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com0tag:blogger.com,1999:blog-7306978581108695483.post-78348615922403858122012-08-17T23:12:00.001-07:002012-08-17T23:12:37.250-07:00Windows update error 0x8024402F<p>I run yesterday into a weird error, for which I spent half of day to solve the problem. It’s unlikely you’d run into the same problem, so this is more for me to remember what I did to fix it in case I run into this again…</p> <p>Yesterday I upgraded my laptop to Windows 8 Pro and installed Office 2013 Consumer Preview (upgrade from Win7 Ultimate/Office 2010). After the upgrade, when I tried to install latest Windows updates, I kept getting error 0x8024402F. </p> <p>I tried the Help page on the error code, I launched the troubleshooter there (which claimed it could be a problem with the server connection, and claimed to have applied fixes), but all lead to nothing.</p> <p>Knowing in the past I had trouble with Windows Update I searched my blog, which pointed out to problems related to UseWUServer set when I joined CorpNet. I left corp.microsoft.com domain and joined my home domain, but that only cost me 2 reboots and still didn’t fix anything.</p> <p>I searched the the net for the error code, I found more KnowledgeBase pages with more FixIt installers which also did not fix the problem.</p> <p>From <a href="http://support.microsoft.com/kb/836941">http://support.microsoft.com/kb/836941</a> I found out the error code means WU_E_PT_ECP_SUCCEEDED_WITH_ERRORS. Further searches on the named error pointed to a WindowsUpdate.log file (instructions for reading it are at <a title="http://support.microsoft.com/kb/902093" href="http://support.microsoft.com/kb/902093">http://support.microsoft.com/kb/902093</a>).</p> <p>I looked in the log file and it contained more error details like this:</p> <p><font color="#000000" size="1" face="Courier New">1060 15a8 PT WARNING: ECP: Failed to validate cab file digest downloaded from </font><a href="http://www.download.windowsupdate.com/msdownload/update/software/svpk/2008/06/1319061_d1590aa04b224974f0cf46ee7937bda90a815268.cab"><font color="#000000" size="1" face="Courier New">http://www.download.windowsupdate.com/msdownload/update/software/svpk/2008/06/1319061_d1590aa04b224974f0cf46ee7937bda90a815268.cab</font></a><font color="#000000" size="1" face="Courier New"> with error 0x80246003</font></p> <p>Great, now I was looking for a different error code, 0x80246003. A search on the error number on Internet didn’t find any solution. The only thing I could find is a KB page <a href="http://support.microsoft.com/kb/938205">http://support.microsoft.com/kb/938205</a> where I learned the error code 0x80246003 is WU_E_DM_UNKNOWNALGORITHM “A download manager operation could not be completed because the file metadata requested an unrecognized hash algorithm.” <br />Further searches on the named error lead nowhere. I tried re-registering the cryptographic providers dlls, comparing with other machines where things were working, all to no avail. </p> <p>I run ProcMon searching for failures (when in doubt, run <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx">Process Monitor</a>), but again this didn’t help.</p> <p>I searched the internal Corpnet site for the error code or named error, but that also didn’t lead to a solutions.</p> <p>Ultimately, I searched the source code. The error code is returned from only one place, from a failed test checking whether test keys are allowed. This had 2 parts:</p> <p>- checking whether I had a file <font size="1">AUTest.cab</font> in <font size="1">%windir%\SoftwareDistribution</font> folder</p> <p>- checking whether <font size="1">HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Test\AllowSHA1ContentHash = (dword)1</font></p> <p>ProcMon should have shown these as well (at least the first one, to begin with), probably I just missed the line between so many other failures.  Anyway, I set easily the registry value, but I didn’t have the file on any other machine where things were working fine.</p> <p>After more CorpNet searches I found on <a title="http://mswikis/wukipedia/Wiki%20Pages/What%20is%20autest.cab.aspx" href="http://mswikis/wukipedia/Wiki%20Pages/What%20is%20autest.cab.aspx">http://mswikis/wukipedia/Wiki%20Pages/What%20is%20autest.cab.aspx</a> where to get this test cab file (I needed to obtain a latest version anyway, since the file is signed and expires every 2 weeks). </p> <p>I copied it to SoftwareDistribution folder, stopped and restarted the Windows Update service (‘net stop wuauserv’/’net start wuauserv’), and next time I tried Windows Update the update finally succeeded! After that I deleted the test cab file, and after that the updates still seem to work fine.</p> <p>I suspect some internal test qfe was installed on my laptop when I joined CorpNet a while ago (giving the old ‘<font size="1">svpk/2008/06</font>’ date of the update, suggesting some Win7 pre-service pack timeframe), and it was causing trouble now. </p> <p>Anyway, I’m glad the problem seems fixed, but just in case here is this article to remind me the solution in case I run into this ever again.</p> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com9tag:blogger.com,1999:blog-7306978581108695483.post-29800062603690634912012-08-09T13:05:00.001-07:002012-08-09T13:05:42.447-07:00How to Shut Down or Restart Windows 8 when connected via Remote Desktop<p> </p> <p>If you connect via Remote Desktop /Terminal Services to a machine running Windows 8 and have tried to shut it down or restart it, you may have hard times finding out how to shut it down. </p> <p>Normally, a Windows 8 machine can be restarted by accessing the Settings screen by pressing <strong>WinKey+I</strong> (or by accessing Charms with WinKey+C and clicking the bottom Settings icon), then by clicking the Power button and selecting Restart / ShutDown from the menu that open. </p> <p>However, when connected via Remote Desktop, Windows 8 offers in the menu only a “Disconnect” option…</p> <p><a href="http://lh3.ggpht.com/-1mB25l7BrOE/UCQYAbRBCUI/AAAAAAAAATc/f4B5kldQ57c/s1600-h/CharmsSettings%25255B5%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="CharmsSettings" border="0" alt="CharmsSettings" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZG6Djtby2cznrNnZCigBtWRHly4c4V3wuY0kE0agxFxH_cxy_B234FcoRy5RinWWuxYl_rGy2_txlibT_pNrMm4HRsaUSHw9n07w0Sbz_s1o41NXcq23JcalCTZiwjITDMGmiuuShY1M/?imgmax=800" width="604" height="484" /></a></p> <p>Another way to access usually the restart options are to press Ctrl+Alt+Del , then click the Power button there and select Restart / Shut Down from the menu that opens. When connected via Remote Desktop, you can access the power button with <strong>Ctrl+Alt+End</strong> ( Ctrl+Alt+Del displays the lock screen on the host machine, not on the machine you’re connected to), but again Windows 8 offers there only the “”Disconnect” option (despite the tooltip on the button indicating Shut Down).</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2pocd06ZBA3bbrQ2oYk_3zZHtkUygAvZQ4SICRpSzO9jeSl_WA_TqLqJggVUFx0KqOCO_KLrxTrFmz29FqFWg3-8d3swZ5wB0yBZ1Eh7-IMWdY1MWcpTMTkS6ZoJTGSmIL2AV8BI0F8E/s1600-h/CtrlAltEnd%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="CtrlAltEnd" border="0" alt="CtrlAltEnd" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN9q5J3hwA7R4PoaFipMDz9YlHUUy3iJSI63CtRFblTFM37Msdfsf8SwZinLs-LMieRdB__pqlchiDMuaKMxPIG74SqT6tzyKGvCm14oSp5xzN-tpako-9hYDTPEBhyGfp6xvY0rYWZAE/?imgmax=800" width="604" height="484" /></a></p> <p> </p> <p><strong>So, how to restart Windows 8 when connected via Remote Desktop?</strong></p> <p>Since most of the time I have a <strong>Command Prompt</strong> window open (can easily open one with WinKey+R, type “cmd” and Enter), until now I’ve restarted the machine by typing “<strong>shutdown –r –f</strong>” in the command window, then agreeing with a notification that Windows will soon restart, or waiting ~30 seconds for the machine to restart automatically. If you just need to shut down the machine, don’t pass the “-r” argument.</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaOaJMHLyZvZyv5CuP5U3mMsoKU2gPoIYUINqBe2zpLAQ2U6_dIxpGvgTGuhr24xAp2RZtNTy5zh1DUZnq2PmHcUiq-kfBJgVgBwFyFqeU85eBwAKJuO9B510a4LLwDGK-pnRSoWQtCDE/s1600-h/ShutdownRF%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="ShutdownRF" border="0" alt="ShutdownRF" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGDwx5dTbIz1h2AgcOKrAXvE_aSoRRk3Kq_nVsT9a5TBE3k1jwJvv6qAgJvKItvTYl4LjJrhLAHh6SLmQGocxBCLOafl7N_8nCPpjG6Mxdib-0F5LqYCKH6d8muFOHTUIvWDISQKdcMfE/?imgmax=800" width="604" height="484" /></a></p> <p>Today I found out another way to restart the computer: you can access the desktop (e.g. by pressing <strong>WinKey+D </strong>= Desktop,<strong> </strong>or <strong>WinKey+M</strong> = MinimizeAll), then press <strong>Alt+F4</strong>.  This displays a Shut Down Windows dialog, where all the options are available! Ah, the good ol’ Desktop… </p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_B2yam2KS5lMiPEEagxcECl9rlnNGTnWOnvQwQAw7BG4lZveVepamoRkyk7yxX8ciFKqFqYjWUO-M1fqJG5RpTgdloN62GlvrbX5W2xx7y5gx2Ep1RI64SJPsOwmg0UaIWNHe-rzyhIE/s1600-h/AltF4%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="AltF4" border="0" alt="AltF4" src="http://lh4.ggpht.com/-WtVxjCARWwU/UCQYElrpknI/AAAAAAAAAUU/uZKDTqp8NSo/AltF4_thumb%25255B1%25255D.png?imgmax=800" width="604" height="484" /></a></p> <p>And, finally if you are a mouse person and prefer a one-click solution, you can create a shortcut to shutdown.exe, then right click it and pin the shortcut to the StartMenu. From now on you’ll be able to shutdown the machine by double clicking the icon on the Start screen or on desktop.</p> <p><a href="http://lh4.ggpht.com/-hCQ0fLZu3Z0/UCQYE7MwscI/AAAAAAAAAUc/PvLcb4qTEd0/s1600-h/ShutdownShortcut%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="ShutdownShortcut" border="0" alt="ShutdownShortcut" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT273MDc73cAENP-cXgLjzG8TxbnEEVmnKoWypaYD7M5rHjfV3GBWk0UEy3RA_iN8HmtP-RA1surx8AKQJCUC8fvFggWIoZHKFJ5DVphyphenhyphen6hbY7QYwvzOR8EXMyPoz4g4-YRBIrpXsQl0k/?imgmax=800" width="644" height="477" /></a></p> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com11tag:blogger.com,1999:blog-7306978581108695483.post-27156569371531615382012-08-06T00:52:00.001-07:002013-11-15T16:41:56.669-08:00How to implement a Quick Launch search provider for Visual Studio 2012<br />
A new feature in Visual Studio 2012 is the Quick Launch which allows searching menu items, tools options, and various other things in VS. It drives its roots from a similar feature provided in Visual Studio 2012 part of the Productivity Power Pack under the Quick Access name.<br />
<a href="http://lh5.ggpht.com/-dG1IBdOyeHc/UB93zOt5GOI/AAAAAAAAASQ/a4ivVqLJsXY/s1600-h/QuickLaunch%25255B3%25255D.png"><img alt="QuickLaunch" border="0" height="57" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiOGfGuuxhy5yAfstmVObQEcf5x8t1cXoWWqVq7pOo35kysbfpwrBPTWFO-1g0-e1nlcCvQaCeTj4jgcRnjq8XArLOlvpQ9xzmvJ0HeJ5bZz6U7WQGvID6Ynvq6HzJBA1w4A-Fp3N9e_I/?imgmax=800" style="background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="QuickLaunch" width="331" /></a><br />
<br />
The following article will tell you how to write a Visual Studio Search Provider integrating with Quick Launch and will demonstrate the functionality with a sample<br />
<br />
Visual Studio 2012 comes with only 4 providers out of the box: menu item, tools options, open documents and most-recently used items. Additional providers can be implemented to extend Quick Launch searches. I believe Microsoft will provide more extension packages and samples but until it does, I’m providing here a primer for writing a new search provider and a sample implementing 2 providers: Fruits and Vegetables, providing their results from 2 hardcoded lists of items.<br />
<a href="http://lh5.ggpht.com/-kfZv30LdmZc/UB93z2Mi3VI/AAAAAAAAASg/gyZrqTmOc4Y/s1600-h/QLFruitsAndVeggies%25255B5%25255D.png"><img alt="QLFruitsAndVeggies" border="0" height="588" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWpKBLoefnhe0cGNSi5rrjCfMbm4aOOq2-3CpwXbd3s8L2pKPevV1OAiOsO1HdR3S2klbC8KRSP4beIlXbJYLnQCRZ4-ElwZDcDymr4Z8RfEqD7MfhucBLNSFqu-Ow2xpN7DEaRtKuVLU/?imgmax=800" style="background-image: none; border: 0px currentColor; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="QLFruitsAndVeggies" width="463" /></a><br />
While Quick Launch is the official feature name, the Visual Studio interfaces supporting the feature use GlobalSearch in the name. The QuickLaunch feature can be accessed from the SVsGlobalSearch service that implements <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsglobalsearchui(v=vs.110).aspx">IVsGlobalSeach</a> and <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsglobalsearchui(v=vs.110).aspx">IVsGlobalSearchUI</a> interfaces.<br />
Providers for Quick Launch are objects implementing the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivssearchprovider(v=vs.110).aspx">IVsSearchProvider</a> interface. They are identified by their unique id (GUID), and they also need to have a unique shortcut string (more on this later).<br />
There are 2 ways to register a new provider for Quick Launch:<br />
1) Dynamic: a loaded package can use <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsglobalsearch.registerprovider(v=vs.110).aspx">IVsGlobalSearch.RegisterProvider</a> interface and pass in the provider object. Dynamic providers can also be unregistered when no longer needed; static providers cannot be unregistered. The provider is available only after the package is loaded; packages may need to use auto-load feature in VS to make sure they get loaded before the user needs their search features. Due to an implementation detail, you can’t use in the same package both dynamic and static registered providers (at least in VS2012 RTM).<br />
2) Static: This is the most common way. In the appid’s configuration hive, under the SearchProviders key, create a subkey with the provider’s Guid, and under it declare the Package Guid implementing the provider. The Name is optional, but is recommended to write one so the providers can be quickly identified at a glance in registry.<br />
<pre><span style="font-family: Courier New; font-size: xx-small;">[HKCU\Software\Microsoft\VisualStudio\11.0_Config\SearchProviders\{9ba8f997-b098-41c9-b360-fecaa397c94f}]
“Name”=”Fruits search provider”
“Package”=”{0bdb8b31-2ee3-4cd9-893a-d0b11d335f06}”
</span></pre>
<br />
<br />
When the providers are loaded, Visual Studio loads the package implementing the provider. The package must implement the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivspackageextensionprovider(v=vs.110)">IVsPackageExtensionProvider</a> interface, and Visual Studio will call the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivspackageextensionprovider.createextensioninstance(v=vs.110)#Y0">CreateExtensionInstance</a> with extensionPoint = IVsSearchProvider interface’s guid, and the interface = guid identifier of the search provider (as declared in registry). The package can then create an instance of the search provider and return the object.<br />
<br />
<br />
When implementing managed search providers, all this extensibility hook-up can be automatically done by using classes from Microsoft.VisualStudio.Shell.11.0.dll.<br />
<br />
<br />
1) First, make sure the class implementing the search provider is attributed with the Guid identifying the provider<br />
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjO9EGEOMDFUWds-zFuda_eiskegv5f86_KSlCPRljoYrFgd5Q_6J03BSthQ0_ichUagExmFZAgO-2iWL3KggaToQO884YQnPRWQeQNvRAP58RR9cr3RZ72TtZBDJVY3WJukMLhAi7ArAI/s1600-h/image%25255B13%25255D.png"><img alt="image" border="0" height="89" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAcqatKZZzPl7sUtvVz9VI26tw6UISl4TRmte44uZaJn0hJHPTHZtSPQkWG7NtES4ZcFmGEF5820cyyEE7bdLsi3Lp80mCqE8bKIsEYNkzYVYvncuXC2ByRImPE7K_1W_IlpqNPpvu0A4/?imgmax=800" style="background-image: none; border: 0px currentColor; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="512" /></a><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
2) Derive the package class from the ExtensionPackage class in Microsoft.VisualStudio.Shell namespace<br />
<br />
<br />
3) Declare the search provider with ProvideSearchProvider registration attribute on the package class.<br />
<br />
<br />
<a href="http://lh5.ggpht.com/-RzNFKSpMcM8/UB931Uoo3xI/AAAAAAAAATA/yTR2IVJ1bUQ/s1600-h/image%25255B17%25255D.png"><img alt="image" border="0" height="167" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj99fNwZQLKEv_Rm4CETSHCepyEGCR9oKasCbr0KzpULS_ux9XG_b2GipZynOx6157ybnPSracla0AVhJZIjY8YVW2k0uMS5KEpxEMGTHPToHFMXu9HEcC308hRAB4b8PKvfvDOYRwB4T4/?imgmax=800" style="background-image: none; border: 0px currentColor; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="865" /></a><br />
<br />
<br />
As mentioned before, search providers are identified by 2 things:<br />
<br />
<br />
- the provider ID, a Guid<br />
<br />
<br />
- the provider shortcut: this is a fixed string (in the sample case, “fruits” or “veg”) which allows performing searches only against this provider, e.g. <a href="mailto:“@fruits">“@fruits</a> apple” will search for “apple” only in the fruits search provider<br />
<br />
<br />
One of the most important functions in a search provider is the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivssearchprovider.createsearch(v=VS.110).aspx">CreateSearch</a> function. Providers are called to create search tasks for the user’s input, then tasks are called on background threads to perform the actual search. To implement a search task I recommend deriving from <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.vssearchtask(v=VS.110).aspx">VsSearchTask</a> in MPF which provides default implementations for IVsSearchTask interface, tracking search status, or notifying the global search manager about the task’s search progress. Usually, if you derive from the class you only have to override and implement the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.vssearchtask.onstartsearch(v=vs.110).aspx">OnStartSearch</a> method, which lets you focus on the important part – perform the actual match/search.<br />
<br />
<br />
Search tasks have to perform very fast. The search manager will only display results that are returned in the first 1000ms, to avoid results and user’s selection ‘jumping’ in the pane after a certain time. If you don’t see any results from your search provider in the pane, it’s either you haven’t reported any results within 1s, or there are many search providers installed in the system and there wasn’t place in the popup to display results from your provider after displaying up to 3 items from other search providers that reported results faster, or from the built-in providers. When reporting search results resultant of slow operations (such as http:// queries to some online search service), it is advisable to query for only top 5-10 items that match, such that the web query return faster and you get to report at least 1 results in the first second.<br />
<br />
<br />
<h4>
Download the Quick Launch Sample</h4>
<br />
<br />
<a href="http://www.alinconstantin.net/download/Example.QuickLaunchSearchProvider.zip" title="http://alinconstantin.homeip.net/download/Example.QuickLaunchSearchProvider.zip">http://www.alinconstantin.net/download/Example.QuickLaunchSearchProvider.zip</a>Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com2tag:blogger.com,1999:blog-7306978581108695483.post-16989101761801314842012-08-02T04:27:00.001-07:002012-08-02T11:10:22.226-07:00Command Window is not available in Visual Studio Express editions<p> </p> <p>As other users have noticed in posts like <a href="http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/fca6f6f9-6450-487a-8785-b03cb3c07d53/">this one</a>, <a href="http://msdn.microsoft.com/en-us/library/c785s0kz.aspx">Command Window</a> is a toolwindow that isn’t available in Visual Studio editions to be explicitly displayed by the user.  The menu commands used to display the window are not available.</p> <p>Fortunately, there are workarounds.</p> <p><a href="http://msdn.microsoft.com/en-us/library/f177hahy.aspx">Immediate Window</a> is another related toolwindow that can be used to display variables’ values, evaluate expressions, and to <em><strong>execute commands</strong></em>. The Immediate Window is automatically displayed when entering Debug mode. It can also be displayed on-demand by using the Debug/Windows/ImmediateWindow (Ctrl+D, I) menu item.</p> <p>Command Window displays automatically a “>” prompt and the user only has to type command names. To execute commands in Immediate Window, the user has to explicitly type the commands by prefixing them with “>”. Full Intellisense support is available here, same as in Command Window. <a href="http://msdn.microsoft.com/en-us/library/c3a0kd3x.aspx">Pre-defined aliases</a> also work fine (of course, trying to execute commands that don’t exist, aka forcing the display of CommandWindow won’t work).</p> <p><a href="http://lh5.ggpht.com/-uSKV5Fv7SAY/UBrCi2EXQyI/AAAAAAAAARs/afvAc5cInDw/s1600-h/image%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhErX_HontpGBT_qXtH6qP43-Q0zVviKpQBRh7AGDFwtHHOwxcLbc8AEDRhhPwuVNehlmRqcwziUDImVfWWWS1HmKlxj7yIiE4GPOBvwdFd6Ru8Q7uWhM8gL3C9GPTmvcAxcEIw6INuqC4/?imgmax=800" width="490" height="265" /></a></p> <p>A second workaround is to use the Find combobox.</p> <p>First, make sure the Find combobox is displayed in the Standard toolbar (in Visual Studio 2012 this has been hidden with the command bar reduction work, so you’ll have to use the quick customize menus to bring it back)</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgte07CYLbvGelnSvRD9Dyau-1Rjd8a7OnSfEbminm7LAzFw6KPwGtaU7EdM6YQ6ArplF6SRCFgLwHiz8GPlrwu9VODErKg9MO9GRLGqwXy1DzO7nAroTdyjHVYsff0yFjCblYz6FpO4FY/s1600-h/image%25255B11%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-aPGiGSWoKHc/UBpkFUigv2I/AAAAAAAAARI/IeJMBuOkbGU/image_thumb%25255B5%25255D.png?imgmax=800" width="444" height="428" /></a></p> <p>Then, in the Find combo you can type commands by starting them with “>”, and the full functionality of Command Window will be available there (with Intellisense, aliases like “of”, etc).</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXAiSzQJxkYWzSH-IgbwRHLDqm7ma3zP7y7dpMKPY75_QUhf-Nent7B0inJ98qAjZviV7MWMZ5Sg91VTZNCSP6Di8tTJyKYJ0sZA0ZHLQDCaPwZn7sQQl6Zd7k7pj9H8ax4CiPnkSVTbc/s1600-h/image%25255B23%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-Jdlo97q7TWk/UBpkK0DdtiI/AAAAAAAAARY/xE3QoGE5RKY/image_thumb%25255B13%25255D.png?imgmax=800" width="375" height="372" /></a></p> <p>The only Professional feature related to Command Window that can’t be workaround in Express editions is redirecting the output to a file. The <a href="http://msdn.microsoft.com/en-us/library/x72c7xc8.aspx">Tools.LogCommandWindowOutput</a> (“log” alias) and Tools.ImmediateMode (“immed” alias) are not available either. Anyway, you won’t need the last one since you are already in Immediate Window, can manually display the toolwindow or execute “>Debug.Immediate” instead from Find combo.</p> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com0tag:blogger.com,1999:blog-7306978581108695483.post-16121924524696505702012-04-02T00:44:00.001-07:002012-04-02T00:44:48.332-07:00Bing reflectionIn case you missed it, <a href="http://www.bing.com/">Bing</a> home page had today an interesting effect: a reflection of the logo and search box on the water in the animated background image - and the reflections were waving with the water waves...<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtbQmrPk4wmvmBh-vRrmPG8KLTdkC_mlKy5xlpSuSMy3VABzhyhFbFAWMj_U7NFLwMGjxf7D6LBtxLvKj7OkvQ5ru5Kg9fJuKgO8bpvp413GiG7WQnGI8sqARwulGNCE5jnWRQRh0oJ1E/s1600/BingWaterReflection.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="379" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtbQmrPk4wmvmBh-vRrmPG8KLTdkC_mlKy5xlpSuSMy3VABzhyhFbFAWMj_U7NFLwMGjxf7D6LBtxLvKj7OkvQ5ru5Kg9fJuKgO8bpvp413GiG7WQnGI8sqARwulGNCE5jnWRQRh0oJ1E/s640/BingWaterReflection.png" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='480' height='380' src='https://www.blogger.com/video.g?token=AD6v5dweZd4ZLOU2j-JB4e2wlNtySQrT44yuCUTvYFAjTdEI9RbJTjaEdTiV5VjDWjobT4g-0PyNDUzy423kx3ZNzg' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />Bing used animated backgrounds before, but I think this is something new. I'm not sure if this was some sort of April's Fool or a new trend in Bing homepages, but I liked the idea.Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com0tag:blogger.com,1999:blog-7306978581108695483.post-20828271205988029062011-09-29T20:00:00.001-07:002011-09-29T20:00:52.669-07:00Have a Windows Phone 7? Here’s how to force a Mango update<p>Microsoft has released Windows Phone 7.5 Mango release, and carriers have already rolling out the update for most models (see <a href="http://www.cnet.com/8301-17918_1-20112417-85/windows-phone-mango-update-schedule-and-new-devices/">list of phones for which Mango update is already rolling</a>). Unfortunately, this roll-out is graduate and it may take weeks until the carrier provider notifies you to install it.</p> <p>But, via <a href="http://www.cnet.com/profile/FnPsychopath/">FnPsychopath</a>’s post in the above mentioned article, there is a way to force the Mango update on phones for which Mango has started rolling out:</p> <blockquote> <p><font face="Courier New">Connect your Windows Phone to a PC and launch the Zune software <br />Click on Phone > Settings > Update. Allow the software to tell you whether an update is available. If so, skip this guide. If not continue to the next step. <br />Time to force the update. Click another button (any of the options above or below the word Update). Then click the Update button again, and this time disconnect your computer from the internet after 1-2 seconds. Do this by pulling out the Ethernet cable, disabling Wi-Fi, etc. If it says your phone is already up to date, you didn't disconnect quickly enough and need to try this step again. <br />Wait 30 seconds or so and Zune should display a notification that an update is available. This is 7392, the first Mango pre-update. <br />Now reconnect to the internet and continue with the update process through the Zune software. <br />After 7392 is fully installed, you may receive a notification that another update is available. If so, install it now. If not, proceed to the next step. <br />If the second update isn't popping up on its own, repeat steps 3-5, causing the 7403 update to appear. <br />Install 7403, brave reader. Speeding right along, isn't it? ;) <br />Mango time! At this point, Zune should automatically start installing the last update, 7720, aka Mango. If it doesn't happen automatically, force it like we did in previous steps. </font></p> </blockquote> <p>Nice hack! It worked for me exactly as described. I’m not sure if this is a bug in Zune software or an intentional feature/workaround, but it sure is handy!</p> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com1tag:blogger.com,1999:blog-7306978581108695483.post-75395087863364106802011-08-25T02:59:00.001-07:002011-08-25T02:59:56.460-07:00<Strings> Element in VSCT files – ButtonText, CommandName, CanonicalName, MenuText, oh my!<p> </p> <p>If you ever added a Button definition in VSCT files for Visual Studio menus, you may have wondered what are all the ButtonText, MenuText, CommandName, etc. elements associated with the button.</p> <p>When you create a new Visual Studio Extensibility project and tell it to create a menu item, accepting the default values, the result is a generated vsct file containing code like this:</p> <pre style="font-family: consolas; background: white; color: black; font-size: 13px"><span style="color: blue">      <</span><span style="color: #a31515">Button</span><span style="color: blue"> </span><span style="color: red">guid</span><span style="color: blue">=</span>"<span style="color: blue">guidVSPackage1CmdSet</span>"<span style="color: blue"> </span><span style="color: red">id</span><span style="color: blue">=</span>"<span style="color: blue">cmdidMyCommand</span>"<span style="color: blue"> </span><span style="color: red">priority</span><span style="color: blue">=</span>"<span style="color: blue">0x0100</span>"<span style="color: blue"> </span><span style="color: red">type</span><span style="color: blue">=</span>"<span style="color: blue">Button</span>"<span style="color: blue">></span><br /><span style="color: blue">        <</span><span style="color: #a31515">Parent</span><span style="color: blue"> </span><span style="color: red">guid</span><span style="color: blue">=</span>"<span style="color: blue">guidVSPackage1CmdSet</span>"<span style="color: blue"> </span><span style="color: red">id</span><span style="color: blue">=</span>"<span style="color: blue">MyMenuGroup</span>"<span style="color: blue"> /></span><br /><span style="color: blue">        <</span><span style="color: #a31515">Icon</span><span style="color: blue"> </span><span style="color: red">guid</span><span style="color: blue">=</span>"<span style="color: blue">guidImages</span>"<span style="color: blue"> </span><span style="color: red">id</span><span style="color: blue">=</span>"<span style="color: blue">bmpPic1</span>"<span style="color: blue"> /></span><br /><span style="color: blue">        <</span><span style="color: #a31515">Strings</span><span style="color: blue">></span><br /><span style="color: blue">          <</span><span style="color: #a31515">CommandName</span><span style="color: blue">></span>cmdidMyCommand<span style="color: blue"></</span><span style="color: #a31515">CommandName</span><span style="color: blue">></span><br /><span style="color: blue">          <</span><span style="color: #a31515">ButtonText</span><span style="color: blue">></span>My Command name<span style="color: blue"></</span><span style="color: #a31515">ButtonText</span><span style="color: blue">></span><br /><span style="color: blue">        </</span><span style="color: #a31515">Strings</span><span style="color: blue">></span><br /><span style="color: blue">      </</span><span style="color: #a31515">Button</span><span style="color: blue">></span></pre><br /><br /><p>I’m going to tell you upfront it’s indicated to change the format of the <font color="#0000ff"><</font><span style="color: #a31515">CommandName</span><span style="color: blue">> </span>element – the project template generator gets it wrong how the value should look like.</p><br /><br /><p>So,  where do these values appear in UI?  There is a <a href="http://msdn.microsoft.com/en-us/library/bb491712.aspx">MSDN article for the Strings Element description</a>, but is a bit confusing, and as writing this article, it contains a couple of mistakes. </p><br /><br /><p>To better exemplify where all these elements appear, let’s start by defining a Button command with each child element specified, like so:</p><br /><br /><p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXYmi3VR4Eo9e8W8uXat8eZP5kQxOINq3tU_vg5yRV3gVd5tigE9L-ppCQAiyPb5Y4Uo-s00iXobEMDMl0jsZb7vQFaasHmesEEFTNUDUgP4E_Vi1Jb-Tga2qFRBBijkLWs5Fk_vqx5G8/s1600-h/VSCT%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="VSCT" border="0" alt="VSCT" src="http://lh5.ggpht.com/-IrIqK7_E2qw/TlYc9Z6R9kI/AAAAAAAAAOk/XDSaFtr64T8/VSCT_thumb%25255B1%25255D.png?imgmax=800" width="845" height="180" /></a></p><br /><br /><br /><br /><p>Now let’s build the project and see where these strings appear in Visual Studio.</p><br /><br /><p>Let’s start with <strong>ButtonText</strong>. This is a mandatory string, and, if any other strings are omitted, this string will be used to generate the other optional values. This means this string can appear in all places  </p><br /><br /><p>As the MSDN page describes, <strong>ButtonText </strong>is used in UI when the button is placed in a menu controller (such as the dropdown menu of the NewProject button):</p><br /><br /><p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4Rdrnem3YDKVMFkkZ_OIsWlbBdORF7tnkHrXKUz-_Pl_Gm19t0rkiielc6FgIYR3V6IqacJa1JDn9kOIr4lfMGhaobByeaX9uH-UiGqYU6PgmM5Uay_iW3ssOCV4s65Sa-XCy-i1DUnY/s1600-h/MenuControllers%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="MenuControllers" border="0" alt="MenuControllers" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3uQDruuu9ngCdrkwCmdu-8vHJhAysIZTng-ThcGLeoqoguGkQsEVEL5jh53iBW5E9DKHtcvt13zRjqkaUWFWbgWyPdPz3uCv7sjJzc6ENksdUnaBJdtCtqFcV1zHGljMYpaMavyY85pE/?imgmax=800" width="483" height="182" /></a></p><br /><br /><p>However, the same <strong>ButtonText</strong> string is used when the button is placed:</p><br /><br /><p>- in the Visual Studio’s Main Menu</p><br /><br /><p>- in a toolbar (e.g. in the Standard toolbar)</p><br /><br /><p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH5KZ4JV3LkGXUR-SXwehhlw-U9kaMtb0v1Mezrh4Y9rjZ3XYVfV7UeVkfKfhz9bT2yqZkrvo6H6A8wT618sKevR9qm3QRcuRSEAvToJo2AyOZ46m3KztkhvFr7mi0DM0Gmcwx_GtX120/s1600-h/MenuToolbars%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="MenuToolbars" border="0" alt="MenuToolbars" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgc9YMLLPawHDSTcJSXGjStQzAbSmjd4vI4eL3t0irb9EXUH9RjlSOfpslupe3eI8x00YHQEryRi30QkLN8s_cEgTmh5g7XfMvd9Bxrnb48wXA9yWRouF7nlTGT_dZ3VSyNRmNIltxiZY/?imgmax=800" width="618" height="202" /></a></p><br /><br /><p>In the same picture, notice also that when the button is placed in a menu (e.g. under the File menu), a different string is used – this time <strong>MenuText</strong> is used.</p><br /><br /><p>A button can be easily added to other menus and toolbars by using the Tools/Customize dialog. However, using the dialog it may be a bit confusing because it displays a different string. Neither <strong>ButtonText</strong> nor <strong>MenuText</strong> will appear in this dialog, despite the dialog mimicking the looks of menus and toolbars. Here, in the Controls list, is used the <strong>CommandName</strong> string.</p><br /><br /><p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBbRyU5VfZKrIxOGJlVUz5MrBhaevsfONsWkNimOQx0fGUZhDFX-A5a5JTTZgJUxhEbtEoDQIEadSiwE6N3AFL4kNorms3GRt09YHnm4ZZj9sFOK2QqMnl14FHS_9ZN70kP6iYcqLcErc/s1600-h/Customize%25255B7%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Customize" border="0" alt="Customize" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9P7DTP4_AkFZybWMjwbaZD7lII4GOfZy-OnfhVxLO01EDNK6JKldt5q0v0dELa4Q0QUt8bXrTQKp-brFnZPZbl5q17cHo0mbDqwZHFeIRx2oUmNzdVjDOjtreRImqBJLE24EDWoKFYgw/?imgmax=800" width="539" height="554" /></a></p><br /><br /><p>The <strong>CommandName</strong> also appears in the Add Command dialog that can be invoked from the Customize dialog, in the Commands list.</p><br /><br /><p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRDYobTkH0Ib4LHIkuU1-G57O_zS18WdLO_yQOfVubBBbePfpGK1SyRwgm6PXEPKTchomdV0oO2klP5D_HMEKVHtAT74HohKKAOHKfGIDMnSZu8TlVJP260ZLIGKHTKDHO03LhOL4UwcQ/s1600-h/CustomizeAdd%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="CustomizeAdd" border="0" alt="CustomizeAdd" src="http://lh5.ggpht.com/-2O8DalrmKuE/TlYdBLh6eSI/AAAAAAAAAPE/ZhAmSShR1lc/CustomizeAdd_thumb%25255B1%25255D.png?imgmax=800" width="589" height="374" /></a></p><br /><br /><p>Now you may see why it’s recommended to change the format of the <strong>CommandName</strong> generated by the project wizard. It may be hard for users to figure out that cmdidMyCommand is actually related to what the user usually sees in the UI for that command, more like “Command Name”. Use a descriptive string for your command names, use spaces and no funky “cmdid” prefixes. Or simply don’t define at all this string, and let the shell display instead the <strong>ButtonText</strong> string – this is probably what you’ll want in most cases.</p><br /><br /><br /><br /><br /><br /><p>The <a href="http://msdn.microsoft.com/en-us/library/bb491712.aspx">MSDN article</a> indicates CommandName is also used in the Tools/Options dialog in the Keyboard page. This is incorrect. The Keyboard dialog displays the <strong>LocCanonicalName </strong>string (or in it’s absence, the ButtonText string), after stripping unwanted characters such as spaces, ellipses, ampersands, etc.</p><br /><br /><p><a href="http://lh4.ggpht.com/-LW6T3Sx_FIc/TlYdEE3dcqI/AAAAAAAAAPI/YcIhbR88Elc/s1600-h/Keyboard%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Keyboard" border="0" alt="Keyboard" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMJwJqjnXy1twgXNwLw8sIHX_2PX4b-sVmI_HVdIO-n-l97aMZpO6WxdbeKsVDYaqV4TzEApHIjrGVbTI81Z8qeV1Toc1wEQIfVNpfkVK0zxdPGvXmckpyNrkPgdjUJGaBEB5CTo4W394/?imgmax=800" width="761" height="444" /></a></p><br /><br /><p>The <strong>LocCanonicalName </strong>string  is also displayed in the Command tool window, in the Intellisense/autocomplete popups. </p><br /><br /><p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmcLlf8VhiN_YR2Z3rTRlrwsvXJVtdbEuN3qtAZrwWT-SCgO_xpaOpGRhN_dN8nJGixm7-VM1BlRUJT8Lwa1cdUEsnbtCoYeTwFJ6qczZv_n6cet0sCv6oulLi6t-rX8R68JLNhATALwg/s1600-h/CommandWindow%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="CommandWindow" border="0" alt="CommandWindow" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQVUUCbH8H1JZMAEs30gSeSW2ZgZ8AeUZO-R8GhQxvwwuIjRkITQhIjs4o8bZuLFD8QPzaEiQDvsgkke1uPdL3y9LY3vtERZyrbob8Si5b0Tz6VXE_p6PgQ3q6vEt9npYAHzyav0BqPjI/?imgmax=800" width="542" height="160" /></a></p><br /><br /><p>Again, the <a href="http://msdn.microsoft.com/en-us/library/bb491712.aspx">MSDN page</a> is a bit misleading here, as it seem to suggest that <strong>CanonicalName</strong> string appears in the Command Window (after being stripped of ampersands, spaces, etc). </p><br /><br /><p>While the autocomplete popup only displays the <strong>LocCanonicalName </strong>string,  both <strong>CanonicalName</strong> and <strong>LocCanonicalName</strong> can be used for command execution, <strong>but you have to type the canonical name string</strong>. Notice that execution succeeded no matter which of these strings was typed, whereas trying to execute an inexistent command displayed an error message. </p><br /><br /><p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib8H-P1Sp4yk7rCfF-YImKkplF4pPuVb1ieSdFjLMerskDluCVjrITp07H-jVFo3YYJIIoo5zNxmEJAU39W59_3CNZLl6Hg04z2pEhguXw5ymuIO83ZqqirFmAprt_He6hq2xoUVJ0qiI/s1600-h/CommandWindow2%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="CommandWindow2" border="0" alt="CommandWindow2" src="http://lh5.ggpht.com/-V4O6YAB4SQc/TlYdGJP-F7I/AAAAAAAAAPc/KEItIBjfusY/CommandWindow2_thumb%25255B1%25255D.png?imgmax=800" width="619" height="208" /></a></p><br /><br /><p>Again, if one of these strings (or both) is omitted from the button’s definition, the ButtonText is used instead to generate a canonical name for command execution and/or the autocomplete popup.</p><br /><br /><p>And finally, the <strong>ToolTipText</strong> string is used for the button’s tooltip, when the button is placed:</p><br /><br /><p>- in the Visual Studio’s main menu, as a top-level button</p><br /><br /><p>- in a toolbar (in this case the keyboard shortcut, if any, is also displayed in the tooltip)</p><br /><br /><p>The tooltip is <strong>not </strong>displayed when the button is placed as a menu item (e.g. in the File menu) as the <a href="http://msdn.microsoft.com/en-us/library/bb491712.aspx">MSDN page</a> indicates.</p><br /><br /><p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBoTcVwDeD6UNt6k-s8LuK6vffafCkx8weSpFisUcqzhLSFcBgCZx_JssVJUdxiLZxHcjJ3lu1OFShMg8qwQBZMxCcUy_b34wfxPtGOYnHf5u6MwEYCDlCGtTaXyGHas7Fc5u_NETle60/s1600-h/TooltipText%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="TooltipText" border="0" alt="TooltipText" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwcP0h53RyqJjEDeL3EwjMiwjxbsvGcUR1rQhEG-xdC9YqxcC5XAErXpI9_Uhvb0BHVPAE-OCB5l7hH_PCW8O3oQDFIoD5Ste5NSbM424H9eW06GbzUBkJJK5HeIyZQg2ZMiUGjQDXDnY/?imgmax=800" width="421" height="145" /></a></p> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com4tag:blogger.com,1999:blog-7306978581108695483.post-75175368502311784732011-07-20T21:39:00.001-07:002011-07-20T21:39:24.165-07:00Facebook scams and removing Facebook posts<p> </p> <p>Facebook scams are proliferating lately, and I just got tricked by one of them, too :-( <br />It starts with a friend sharing a link like "Crazy girl must be nuts but also a damn smart for mak1ng this video". If you click it and follow the "age verification" prompts that follow you'll only help the malware spread - as it will add without your knowledge an identical post to your wall. <br />The Jaa button in the “age verifications” prompts is not the German word for Yes, but the Finnish word for Share :-) <br />So, if you see such posts, don't follow the links!</p> <p>Graham Cluley security analyst at Sophos Antivirus describes better similar malware on his blog <br /><a title="http://nakedsecurity.sophos.com/2011/07/12/a-spider-under-the-skin-its-a-facebook-survey-scam/" href="http://nakedsecurity.sophos.com/2011/07/12/a-spider-under-the-skin-its-a-facebook-survey-scam/">http://nakedsecurity.sophos.com/2011/07/12/a-spider-under-the-skin-its-a-facebook-survey-scam/</a></p> <p>If  you made the mistake of following the link, and now you have an unwanted post on your wall, here is how to delete the post from the Facebook page: Hover the post in your wall. An X blue button will appear in the right of the message. Use the button</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMfwesCCjEnnZFtGcMXWZVsaTDjzdE18jJs_-Q1SEJ7d1ATCUOJneYhkeu50HDJ9aO-cNQXhp2atxgzDaZqnLHAgUNd77Oo-VEqKrQrdOq7Fsfe5JCLpBJrV9j2lXOXWAebecZENGSEX4/s1600-h/image%25255B10%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQfbYLAeenp809O8Kk_6sWzMSJTpX7jwYxVxEMNsBDGKzB51Xs0Vhpag9IIM3dv-YeIqEmYSXSu2AKfBTO3Vzm2HN7fH4P8JyIcK2BJYZaXpdaITRsGwTQuPWFGGhMgEBFoi_hcCgi3bk/?imgmax=800" width="526" height="169" /></a></p> <p>Click the button to open a context menu and choose to Report it – it will remove it and report as malware. The same removal X button can be accessed from the post’s thread page (that you can access by clicking the link with the timestamp of the post, highlighted above)</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibX-un3te4HarGeLqtpz2q_3puEp74xN7Zn4ZRoJU7Krh4U8NG-ZxG251YrxrAaIYT-jc2SReJHF-9GlC9CVs2RPAJG-gnhduW1kfW3cj9AwLswbqnYiDI2V0WZqr-07WEo6cyV1AhHz4/s1600-h/image%25255B13%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuX3FknaWZiZ5SjmoMB-M5RdnGhS3DEZtvlLZWac_3BALyPS73w291mm6nieEtKj9L7bdS8uvG6_flqXtGJd0QLsYu7V3WhdEgy89IY0tpZm2_WQabAsIht6r8S0hdJhi0VUchsDRzpHE/?imgmax=800" width="152" height="104" /></a></p> Alin Constantinhttp://www.blogger.com/profile/16976709451979541487noreply@blogger.com3