Category Archive for Microsoft

Visual Studio 2010 SP 1 Beta

Microsoft has released Visual Studio 2010 SP1 Beta. It’s available right now for MSDN subscribers and will be available to everyone on Thursday.

It includes a new help viewer that I mentioned in my previous blog entry and “Win7-specific MFC APIs to support use of Direct2D, DirectWrite, and Windows Animation Technologies”. I can’t wait to try those out 🙂

Get more details here.

Share

Visual Studio 2010 SP1 – Help Viewer

Microsoft is planning to include a new help viewer with Visual Studio 2010 SP1, which is long overdue 🙂

You can see a presentation here.

Share

Free eBooks Related to Microsoft Technologies

Here is a list of free eBooks related to Microsoft technologies.

Enjoy 🙂

Share

Visual Studio 2010 Feature Pack 2 Released

Microsoft released Visual Studio 2010 Feature Pack 2 to MSDN subscribers which extends testing, code visualization and modeling capabilities in VS2010. Its main features are more advanced platform and tool support for both manual and automated testing scenarios. It allows you to better control your Silverlight 4 testing scenarios and UI testing code.

Feature Pack 2 includes the following C++ related additions:

Feature Pack 2 is cumulative and includes Feature Pack 1.

Get more information here.

Share

Native C++ Development is Still Being Used

I just stumbled upon an article mentioning that Evernote abandoned WPF and the Microsoft .NET framework and rewrote their application from scratch in native C++ code 🙂 The official reason given:

The blurry fonts, slow startup times, large memory footprint, and poor support for certain graphics cards were all issues that the technology behind 3.5 was incapable of resolving. As a result, we ended up chasing down platform bugs rather than adding the great features our users wanted.

Read the article here.

Share

Defining x64 Target Platform for VC++ Projects

Marius Bancila posted an excellent post on his blog explaining how to define x64 target for you Visual C++ Projects.

If you want to port an existing 32-bit application for the x64 platform (especially since 32-bit processors will soon be history), or if you want to target x64 for a new application, the first step in building for x64 is setting up your solution. In this post I will explain what are the steps in configuring x64 as target platform for your projects. Of course you must have the 64-bit compiler and tools installed to make this possible.

Read the full article.

Share

Microsoft Security Essentials Available FREE to Small Businesses in October

In October, Microsoft will be making a change to the licensing of its Microsoft Security Essentials product. After the change, small businesses can install the Security Essentials on up to 10 PCs for FREE. Previously, it was only free for consumer use. Microsoft Security Essentials provides protection from viruses, spyware and other malicious threats.

Get more information on MSDN.

Visit the Microsoft Security Essentials website.

Share

Windows Phone 7 Final Developers Tools Released

Microsoft has released the final version of the Windows Phone 7 developers tools 🙂
The package includes everything you need to start writing applications and games for Windows Phone 7. The package is completely free and includes all of the following:

  • Visual Studio 2010 Express for Windows Phone – Free edition of VS 2010 for Phone development.
  • Express Blend 4 for Windows Phone – Free version of Blend for Windows Phone 7 Development.
  • Silverlight for Windows Phone 7 – Rich framework for building great applications for Windows Phone 7.
  • XNA Game Studio for Windows Phone 7 – Rich framework that enables you to build great 2D and 3D games for Windows Phone 7.
  • Windows Phone Emulator – A hardware accelerated emulator that allows you to run and debug your applications and games without requiring a phone.
  • Phone Registration Tool – When you get a device, this allows you to “unlock” the device so you can run/debug your application on it, using your Marketplace account.

Download the tools here.
Read Scott Guthrie’s blog post to get much more details on the release.

Share

Querying Bing Using the New Windows 7 Web Services C++ API (WWSAPI)

According to MSDN, WWSAPI is a native-code implementation of SOAP which provides core network communication functionality by supporting a set of the WS-* and .NET-* family of protocols. WWSAPI is designed to be used by components/applications which fall into one of the following categories:

  • Native code mandate
  • Require minimal dependencies
  • Require minimal startup time
  • Memory constrained environments

Using this brand new API, it is possible to make native-code SOAP based web services and clients for SOAP based web services. I wrote an article that explains how to build client applications that use SOAP based web services. The web service that I used in the examples is the Microsoft Bing SOAP API which allows you to search for text, images and so on. The article just went live on CodeGuru. Read the full article.

Share

Internet Explorer 9 Beta is Out

Today Microsoft released a public beta of Internet Explorer 9. The new version is much better standard compliant and support such standards as HTML5, CSS3 and SVG2. It scores a nice 95/100 on the Acid3 test. I just installed it myself and I’m impressed with how much faster it works compared to IE8. You can read a full review here.
Download it here.

Share

Office 2010 and SharePoint Server 2010 Launched for Business Customers

Microsoft has launched the following products for business customers:

  • Office 2010
  • SharePoint Server 2010
  • Visio 2010
  • Project 2010

“Microsoft’s Office 2010 and SharePoint 2010 beta programs were the largest ever, with three times the number of participants compared with the Office 2007 beta program. As a result, 8.6 million people are already using Office 2010 and related products. In addition, more than 1,000 partners are already building solutions for the 2010 set of products.”

Right now it’s available in 14 languages. In the next few months it will become available in 94 languages.

Read the full press release.

Share

New Windows Phone Developer Tools CTP is Compatible with Visual Studio 2010 RTM

Microsoft has just released a refreshed version of the Windows Phone Developer Tools CTP. The biggest change is that it is now compatible with the final version of Visual Studio 2010 RTM 🙂

The CTP includes the following components:

  • Visual Studio 2010 Express for Windows Phone CTP
  • Windows Phone Emulator CTP
  • Silverlight for Windows Phone CTP
  • XNA Game Studio 4.0 CTP

Get it here.

Share

Visual Studio 2010 RTM not Compatible with the Windows Phone Developer Tools CTP

A few days ago, Microsoft released Visual Studio 2010. Unfortunately, for the time being, this final version is not compatible with the Windows Phone Developer Tools CTP that was released a while ago. According to Charlie Kindel:

“If you install the retail (RTM) release of Visual Studio 2010 on the same machine on which you already have the Windows Phone Developer Tools CTP, you will be unable to build your Windows Phone projects.  Further, while the Windows Phone project type will continue to appear in the File/New dialog, you will not be able to build Windows Phone 7 applications.”

The Windows Phone Developer Tools are being updated and a version that supports the final version of Visual Studio 2010 will be released in a few weeks.

In the meantime, Charlie Kindel recommends the following if you need the retail version of Visual Studio 2010 together with the Windows Phone Developer Tools CTP:

  • Install Visual Studio 2010 to a VPC image
  • Install Visual Studio 2010  on another machine

Note that installing the Windows Phone Developer Tools CTP to a VPC image is not supported.

Register here to be informed when an updated version of the Windows Phone Developer Tools is released.

Share

Microsoft Visual Studio 2010 and .NET Framework 4 Released

Today, Microsoft released Visual Studio 2010 and the .NET Framework 4. A lot of new features are included. One of them is a completely new editor.

“Visual Studio 2010 and .NET Framework 4 have something for every developer. The new editor, now using Windows Presentation Foundation, delivers a more flexible, feature-rich environment that supports concepts such as the use of multiple monitors. This enables a developer to have one monitor with code, another with the user interface designer, and yet another with database structure.”

Visual C++ 2010 also includes a lot of new features, some of them are:

  • MSBuild and multi-targeting
  • IntelliSense and Browsing (#include auto completion, call hierarchy, red squiggles, find all references, class wizard)
  • C++ compiler changes (static_assert, auto keyword, lambda, decltype, rvalue references)
  • Ribbon designer
  • Deployment changes
  • Task dialog support
  • Restart manager support

Read the full press release here or watch the keynote.

Later this week, Silverlight 4 will also be released to the web (RTW). At that time, an update for Visual Studio 2010 will also become available that will allow you to develop applications using Silverlight 4.

Share

Overview of New Features in Visual C++ 2010

A friend of mine, Marius Bancila, wrote several blog posts with details about new features in Visual C++ 2010.

He touches the following features:

  • MSBuild and multi-targeting
  • IntelliSense and Browsing (#include auto completion, call hierarchy, red squiggles, find all references, class wizard)
  • C++ compiler changes (static_assert, auto keyword, lambda, decltype, rvalue references)
  • Ribbon designer
  • Deployment changes
  • Task dialog support
  • Restart manager support

You can read his posts here. They give you a good idea of new features in VC++ 2010 🙂

Share

How To Handle Custom URL Protocols with the Microsoft WebBrowser Control

Now that you know “How To Use the Microsoft WebBrowser Control to Render HTML from Memory” and “How To Navigate to an Anchor in the Microsoft WebBrowser Control when Rendering HTML from Memory“, it’s time to learn how to handle custom URL protocols to tailor the navigation inside the WebBrowser Control to fit your application. The following demonstrates a custom URL protocol called “app”:

<a href="app://some.target">Test</a>

When you would put this link in a normal Internet Explorer window, clicking the link will generate an error because IE does not know how to handle the APP protocol. The name APP is chosen arbitrarily. You can use whatever you want. Handling these custom protocols in your C++ application is actually pretty simple and it doesn’t even involve any real COM coding like in the previous articles. The first thing you need to do is to add a handler for the BeforeNavigate2 handler. Open the resource editor and open your dialog with the WebBrowser control. Right click the WebBrowser control and select “Add Event Handler…”. Select “BeforeNavigate2” as message type, select the appropriate class and click “Add and Edit”. This handler will be called right before the WebBrowser control will navigate to a new page. To handle the custom protocol, implement the handler as follows:

void CMyDlg::BeforeNavigate2Explorer(LPDISPATCH pDisp, VARIANT* URL, VARIANT* Flags,
    VARIANT* TargetFrameName, VARIANT* PostData, VARIANT* Headers, BOOL* Cancel)
{
    const wchar_t* cpszProtocolName = L"app";
    const wchar_t* cpszProtocolSeparator = L"://";

    // We only handle VT_BSTR.
    if (URL->vt != VT_BSTR)
        return;

    // Check the protocol of the URL
    CString str = URL->bstrVal;
    int iPos = str.Find(cpszProtocolSeparator);
    if (iPos == -1)    // Unable to figure out protocol
        return;

    // Extract protocol and check if it's our APP protocol
    CString strProtocol = str.Mid(0, iPos);
    if (strProtocol.CompareNoCase(cpszProtocolName))
        return;    // not our APP protocol

    // It's our APP protocol, so start processing it.
    // Start by preventing Internet Explorer from handling the protocol.
    *Cancel = TRUE;

    // Extract target URL
    CString strTarget = str.Mid(iPos+wcslen(cpszProtocolSeparator));
    strTarget.TrimRight(L"/");

    // Now we are ready to process our protocol.
    // For this demo, I just render a new HTML page with the name
    // of the URL target without the protocol part of the string.
    CString strHTML;
    strHTML.Format(L"My APP protocol processing: \"%s\"", strTarget);
    WriteHTML(strHTML);
}

The flow is pretty straightforward. The URL protocol is extracted; if it’s not our protocol, we let Internet Explorer handle the URL for us. If it is our custom “APP” protocol, we first set Cancel to TRUE which will prevent Internet Explorer from handling this URL protocol. Once that is done, we are completely free to implement the handling of the “APP” protocol however we want. As demonstration I just write a new HTML document from memory which will just mention that we are processing an “APP” protocol URL and that will also display the target part of the URL.

You can quickly test the code with the following piece of HTML rendered from memory:

WriteHTML(L"<html><body>"
    L"<p><a href=\"app://FirstAppProtocolTestLink\">test 1</a></p>"
    L"<p><a href=\"APP://SecondAppProtocolTestLink.Withdots\">test 2</a></p>"
    L"</body></html>");

Run the application, click on the “test 1” or “test 2” link and see what happens.

That’s it for handling custom URL protocols in C++ 🙂

Share

How To Navigate to an Anchor in the Microsoft WebBrowser Control when Rendering HTML from Memory

In my previous blog entry titled “How To Use the Microsoft WebBrowser Control to Render HTML from Memory” I described a method how you could use the Microsoft WebBrowser Control to display HTML from memory. One commenter said that it was not possible to navigate to an anchor in the body onload handler. I did some research and it seems all navigation within the rendered page is not working. For example, the following piece of HTML code will not work correctly:

<a href="#n25">Jump to anchor n25</a>
<a name="n25">25</a>

It took me a while to find a workaround, so that’s why I’m posting it now for other people to use. Basically, we cannot use the standard navigation techniques. I tried several possible workaround and the only one that I got working properly is by manually scrolling the window until the requested anchor is visible. It sounds complicated, but it really works pretty nicely. I wrote this little wrapper function to do all the hard work.

void CMyDlg::ScrollToAnchor(const wchar_t* anchor)
{
    IDispatch* pHtmlDoc = m_explorer.get_Document();
    if (!pHtmlDoc)
        return;
    CComPtr<IHTMLDocument2> doc2;
    doc2.Attach((IHTMLDocument2*)pHtmlDoc);
    if (doc2)
    {
        CComPtr<IHTMLElementCollection> anchors;
        HRESULT hr = doc2->get_anchors(&anchors);
        if (SUCCEEDED(hr) && anchors)
        {
            _variant_t index = 0;
            _variant_t str = anchor;
            IDispatch *pdisp;
            hr = anchors->item(str, index, &pdisp);
            if (SUCCEEDED(hr) && pdisp)
            {
                CComPtr<IHTMLElement> el;
                hr = pdisp->QueryInterface(IID_IHTMLElement, (void**)&el);
                if (SUCCEEDED(hr) && el)
                {
                    long yTotal = 0;
                    while (1)
                    {
                        long y;
                        el->get_offsetTop(&y);
                        yTotal += y;
                        CComPtr<IHTMLElement> el2;
                        hr = el->get_offsetParent(&el2);
                        if (SUCCEEDED(hr) && el2)
                            el = el2;
                        else
                            break;
                    }
                    CComPtr<IHTMLWindow2> wnd;
                    hr = doc2->get_parentWindow(&wnd);
                    if (SUCCEEDED(hr) && wnd)
                        wnd->scrollTo(0, yTotal);
                }
            }
        }
    }
}

What it does is it gets a pointer to the document. Then gets a list of all the anchors in the document and get the anchor with the given name out of that list. Once we have the target element, we calculate the offset from the top of the document. This is done in a while loop, because the target anchor could be inside another element like a div or a table. After calculating the offset, we get a pointer to the HTML window and call the scrollTo function to make it scroll to the anchor position.

Now the only thing you need to do is to render your HTML using the method in my previous blog entry and then call this new ScrollToAnchor function with the name of the anchor to which you want to scroll.

Share

“Windows Phone 7 Series” Becomes “Windows Phone 7”

It seems Microsoft listened to all the complains about the long name for the new Windows phone. The Microsoft Windows Phone twitter page just had the following message:

“Tis the season for Series finales. We’ve got one too – dropping the ‘Series’ and keeping the ‘Windows Phone 7.’ Done.”

Excellent, “Windows Phone 7” sounds much better without the strange “Series” behind it 🙂

Share

Microsoft MVP VC++ 2010 Award

I got the confirmation email from Microsoft that my MVP (Most Valuable Professional) award for Visual C++ is extended for 2010 🙂

See my MVP profile.

Share

Start Developing Applications for Windows Phone 7 Series

The Windows Phone Application Platform was revealed at MIX 2010. If you couldn’t make it to Las Vegas to attend MIX, you can find the keynotes and sessions here. They explain in great details the Windows Phone 7 Series and how to develop applications for it.

The WP7S developer platform contains 2 frameworks:

  • Silverlight: to make rich interactive applications
  • XNA: to make complex 2D/3D games

Code is written in C#.

Everyone can start writing applications for the new phone platform. You only need to download 1 free package. This packages contains:

  • Visual Studio 2010 Express for Windows Phone CTP
  • Windows Phone Emulator CTP
  • Silverlight for Windows Phone CTP
  • XNA 4.0 Game Studio CTP

Download the package to get started. Only Windows Vista and Windows 7 are officially supported to run the tools. Note that the tools are currently in CTP state so they are not yet final. If you want to use Expression Blend you have to download it separately.

More information can be found on the Windows Phone 7 Series Developer Site, where you can also find developer guides, more detailed information, Windows Marketplace submission guidelines, forums, a few code samples etc…

Share