Posts tagged ‘Google’

Quick and Easy Google (or Bing) Web Search in Visual Studio

Here is a quick and easy way to add a Google (or Bing) Web Search link to the context menu in Visual Studio:

  • Open the Visual Studio macros IDE by navigating to Tools –> Macros –> Macros IDE (or pressing Alt+F11).
  • Right click on “MyMacros” and select Add New –> Add New Item.
  • Select the Module template, name the module “Search”, and click Add.
  • Paste the following code directly before the “End Module” line:
    Sub Search()
        Dim strUrl As String
        Dim selection As TextSelection = DTE.ActiveDocument.Selection()
        If selection.Text <> "" Then
            strUrl = "www.google.com/search?q=" + selection.Text
            'strUrl = "www.bing.com/search?q=" + selection.Text
            DTE.ExecuteCommand("View.URL", strUrl)
        Else
            MsgBox("Select Text first to Search")
        End If
    End Sub
    
  • (Optional) If you prefer to use Bing for your search, uncomment the Bing line and comment out the Google line.
  • Your macro editor window should now look something like this:
    image
  • Save and close the Macro Editor window and IDE.
  • Right click on the Visual Studio toolbar and select Customize.
  • Under the Toolbars tab, check the Context Menus option and the switch to the Commands tab.
  • Select the Macros Category, and then select the “MyMacros.Search.Search” macro.
  • Drag the selected macro onto “Editor Context Menus” -> “Code Window” and then drop it where you want it in the context menu (I place mine below the Paste command).
  • Right click on the new context menu item and change it’s name to “&Web Search”.
  • Click close on the Customize window.
  • You are now done! If everything has gone according to plan, when viewing a source code file you should now see a new context menu item that will do a web search on any selected text when you click it:
    image
    image
    • email
    • DotNetKicks
    • Digg
    • del.icio.us
    • Technorati
    • StumbleUpon
    • LinkedIn
    • Facebook
    • Twitter
    • Google Bookmarks
    • Live

New Links: Google AJAX APIs Playground and Microsoft SDKs

I came across two very cool links today that I thought I would save so I could find them later:

  • Google AJAX APIs Playground - http://code.google.com/apis/ajax/playground/
    • This page is located on the Google Code website and provides example javascript code and documentation links for what seems to be all of Google’s AJAX web services. It includes an interactive code window that allows you to modify the example code, run it, and see the results in a preview pane. Looks to be exceeding useful as a reference for experimenting with and implementing Google web services.
  • Microsoft SDKshttp://msdn.microsoft.com/en-us/dd299405.aspx
    • This page has links to all of Microsoft’s SDK downloads. Azure, Visual Studio, Office, XNA, Mobile, Silverlight, etc. You name, it’s got it.
    • You can find out more information about this new page by reading this blog post from a member of the Windows SDK team.

 

These links have also been added to the links collection in the right sidebar of this blog for quick access.

  • email
  • DotNetKicks
  • Digg
  • del.icio.us
  • Technorati
  • StumbleUpon
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live