My Wish List for Windows “Blue”

Friday, May 17, 2013

Many rumors are flying around at this time about the upcoming release of Windows 8.1 (code named “Blue”, which represents a wave of product updates, including Windows Phone and others). I thought I‘d state my hopes for this release, not just in terms of user features, but also from a developer’s perspective. As a developer, I spend most of my time on my trusty laptop, not some tablet based device. Naturally, the desktop world is my friend. The Windows 8 Start screen is close to perfect for tablet devices, but for the desktop – it’s practically useless. With many...

My New Book Project

Tuesday, March 5, 2013

Those of you who follow my blog may have noticed a slowdown in posts. The main reason for this is that I am working on a new book, titled “Windows 8 C++ App Development” to published by Packt Publishing in about 2 months time.The book has now an official URL in Pack’s web site (no Amazon link yet, but soon…).The book is aimed towards C++ developers that want to use the power and flexibility of C++ to write Windows 8 Store Apps, while leveraging XAML as the UI technology. It includes a good coverage of C++/CX and most features...

Making HTTP calls in WinRT with C++

Monday, January 14, 2013

When working with Windows Store applications (“metro”), it’s sometimes necessary to make HTTP calls. one classic example is to register for push notifications. After obtaining a unique channel URI, the app needs to send that URI to its application server, as that particular URI is the one to use by the application server to execute a push notification against the Windows Notification Service (WNS).Getting the channel URI is fairly simple, with a call to the static PushNotificationChannelManager::CreatePushNotificationChannelForApplicationAsync method. Now comes the tricky part: how to send the resulting URI to the application server?In .NET, things are relatively easy. Just use...

Windows Runtime with C++/C#: Anatomy of a WinRT Class

Sunday, December 30, 2012

The Windows Runtime (WinRT) is based on COM (I referred to it in the past as a “better COM”), which means every method and property must be part of an interface. Also, COM does not support static members (only instance members) and does not easily support parameterized constructors. Inheritance is again an issue in classic COM – the closest thing is COM aggregation, and that’s not really inheritance in the usual sense of the word.Using C++/CX or a .NET language allows creating WinRT types that support methods, properties, constructors and static members, and even events (another feature that is...

Windows 8 Store apps with C++/CX: thoughts & tips

Friday, October 5, 2012

I’ve been working on Windows 8 apps lately using C++, not C#. I’ve been doing a lot of C# work in the past few years, and I must admit I love the elegance of C# and the productivity of .NET, not to mention the powerful toolset bound with Visual Studio. Still, ever since WinRT was introduced, the idea of using native code only had its appeal. Even if the app does not require special libraries, such as DirectX or C++ AMP, native code has less overhead and lower memory consumption compared to a .NET app.Naturally, I was using the...

Accessing WinRT From Desktop apps (Part 1)

Thursday, September 13, 2012

The Windows Runtime (WinRT) is the underlying runtime for Windows 8 Store Apps (“Metro”), but some of it can be actually used outside the Metro environment, in regular desktop apps, such as pure Win32, MFC, etc.There are several ways to go about it; most of the time we’ll use the Windows Runtime Library (WRL) to help out with some of the low level details. Or, for a true high level abstraction, we can use the C++/CX extensions to the C++ language (making our code non-standard). But, just for kicks, let’s see how we can access WinRT types with no...

Windows 8 & Phone 8 UG August Meeting

Wednesday, August 29, 2012

Last evening we had a User Group meeting in Microsoft Offices in Ra’anana, with a lot of activity and fun. Thank you all for participating!In the first part, we discussed the Windows 8 Store from various angles, end user and developer.In the second part, we discussed Windows Phone 7.x and the upcoming 8, along with other sporadic topics - C++, WinRT, DirectX, COM, XNA, XAML… it was fun! And don’t forget the giveaways!Just as a gentle reminder, out next meeting is on September 13th, where we’ll have an interesting session on “Metro” User Experience and User Interface from an...

Can Windows 8 Apps Share Memory?

Tuesday, August 21, 2012

Windows 8 Applications (formerly Metro) run inside a sandbox, making communicating with other application difficult at best. There is no easy way to do it, and for good reason, too. When one app is running, all other may be suspended, so what’s the point of communicating anyway? Furthermore, there is no guarantee that the other app even exists on the machine.Still, suppose we wanted to share some information (I’m not talking about the standard share contract) via (say) shared memory. Can we achieve that?Flipping to the documentation of the CreateFileMapping Win32 API shows that unfortunately this is only available...

Windows 8 Metro: Detecting scroll changes in ListView

Monday, July 2, 2012

I had a requirement in a Metro app I’m working on to detect scrolling in a ListView (GridView is practically the same), or more precisely, detect whether the selected item goes off the visible ListView area, and if so, switch some items in the ListView so that the selected item be visible again; this is not an entirely accurate description, but it’s close enough for our purposes. An easy one, right?Searching the ListView class (and its bases) yields no useful results on scrolling. In WPF, the ScrollViewer element has an attached event, ScrollChanged. This can be used (in WPF)...

Windows 8 Metro: C++/CX vs. C#

Monday, June 25, 2012

Lately, I’ve been doing development of a Windows 8 Metro application using C++ only (yes, that’s right, no C#) for a client. The reasons for that are mainly an existing C++ code base and a good C++ acquaintance that the team in question has.I’ve been using the new C++/CX extensions that make it easier to work with the Windows Runtime (WinRT); easier with respect to the Windows Runtime Library (WRL) that uses standard C++ with a bunch of helpers (such as ComPtr<T> as a smart pointer for a COM/WinRT interface).Even with C++/CX, the amount (verbosity) and complexity of of...