DCSIMG
Win32 - Pavel's Blog
Sign in | Join | Help

Pavel's Blog

Pavel is a software guy that is interested in almost everything
software related... way too much for too little time

Browse by Tags

My Wish List for Windows “Blue”
17 May 13 05:48 PM | pavely | with no comments
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...
My New Book Project
05 March 13 05:57 AM | pavely | with no comments
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...
Windows Media Foundation in Windows 8
20 November 12 10:45 AM | pavely | with no comments
Windows Media Foundation was introduced in Windows Vista as a future replacement for DirectShow , enhanced in Windows 7, and naturally, further enhanced in Windows 8. I’ve blogged about WMF before . While looking at the MSDN docs on WMF, it seems the content has not yet been updated for Windows 8. Windows 7 enhancements are considered there as such. Looking at the API reference, however, shows some new interfaces that are only supported starting with Windows 8. One such interface is IMFMediaEngine...
Using C++/CX in Desktop apps
29 September 12 04:20 PM | pavely | 4 comment(s)
In my first and second post on using WinRT in a desktop app, we’ve used the raw API and then WRL to create and access WinRT objects. It would be easier to access WinRT using the new C++/CX extensions. Can we do that from a desktop app? Let’s give it a try. We’ll start with a regular Win32 Console application project. The first thing we need to do is to enable the C++/CX extensions. Open project properties and navigate to the C/C++ / General node and set “ Consume Windows Runtime Extension ” to Yes...
Accessing WinRT from Desktop Apps (Part 2)
24 September 12 04:24 PM | pavely | 1 comment(s)
In the previous post we’ve seen how to instantiate WinRT objects using the raw (Ro, pun intended) API. In this post, we’ll see some shortcuts to make our lives a little easier. These shortcuts are part of the Windows Runtime template Library (WRL). This is a helper library, similar in spirit to the Active Template Library (ATL) used for classic COM work. First we need to include the main WRL header, <wrl.h> . Also, we’ll include another header with some extra helpers, that are not included...
Accessing WinRT From Desktop apps (Part 1)
13 September 12 12:17 PM | pavely | 1 comment(s)
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...
Can Windows 8 Apps Share Memory?
21 August 12 04:52 PM | pavely | 4 comment(s)
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...
Windows Media Foundation: Controlling Camera Properties
19 May 12 11:05 PM | pavely | with no comments
I have blogged about Media Foundation before; it’s the “next generation” of DirectShow , introduced in Windows Vista, enhanced in Windows 7 and further enhanced in Windows 8 (more on that in a future post). One of the tasks I encountered recently was to do a video capture from a camera. This is not too difficult to do (once you understand how Media Foundation works) and there’s even two sample in the SDK. But how do you control various camera properties, such as focus, zoom, white balance, etc.?...
Windows 8: TopMost vs. TopMost
16 May 12 09:54 AM | pavely | 3 comment(s)
In Windows, a Window can be made topmost, by setting an extended style with the value WS_EX_TOPMOST (8), typically provided to CreateWindowEx . A topmost window is always on top of non-topmost windows. Among all topmost windows, the normal z-order rules apply. That is, until Windows 8. A Metro application is built with a topmost window – that makes perfect sense. What about desktop apps? Here’s an empty desktop snapped with a metro app (the desktop itself can be seen as a kind of metro app): Now...
Win32 and Metro–CreateFile(2)
03 May 12 01:05 PM | pavely | 1 comment(s)
When a new Windows version comes out, I’m always curious about the new Windows API (Win32) functions that are added to the release. With Windows 8, things get a little more complicated, as there are desktop apps and there are metro apps. Now, for every Windows API function the documentation states whether this API is valid for desktop apps only or for desktop apps and metro apps. One classic function is CreateFile . This is one of the oldest functions – exists since the very first Windows NT version...
What’s New in CLR 4.5 Debugging API?
03 April 12 07:51 PM | pavely | with no comments
The most used command in the SOS extension DLL is probably !dumpheap . This command is able to show every object on the managed heap. This capability has no match within Visual Studio. The reason is that Visual Studio uses the CLR debugging API , that doesn’t seem to have this capability. At first glance, the ICorDebugProcess interface has the perfect method: EnumerateObjects . What could be better than that? Unfortunately, the documentation states that this method is not implemented… bummer. A while...
Reminder: WPDUG September Meeting
04 September 11 01:05 AM | pavely | with no comments
This Wednesday (the 7th) will hold a Windows Platform Developer User Group meeting in Microsoft’s offices in Ra’anana (Israel). Our first session will be about adding realtime and deterministic capabilities to Windows and its impact on the system and the ways to program such a system (all based on addons by a company called TenAsys ). The second session will demonstrate useful (and undocumented) debugging tips and tricks in Visual Studio (primarily for native developers). Should be interesting for...
GetShellWindow vs. GetDesktopWindow
18 June 11 09:06 PM | pavely | with no comments
In his post about running a process as a standard user from an elevated process, Aaron Margosis uses a technique that gets the access token of the shell process (typically explorer.exe) and uses that token to launch the new process ( Sasha Goldshtein also blogged about that). The first thing his code does is try to locate the shell process id. One way is to look for “explorer.exe” in the list of processes, but that’s a bit limiting, as there may be a different shell, or it may have been renamed for...
Getting Media File Info
20 March 11 11:55 AM | pavely | 9 comment(s)
So, what can we do with Media Foundation? One of the simplest things, perhaps, is getting information on some media file, somewhat similar to what we see in Windows Explorer, but we can dig deeper if we like. Let’s get started. First, we’ll create a simple Win32 console application named MediaInfo (I check the box to include ATL headers, we’ll use ATL smart pointers). We then add some Media Foundation includes (e.g. in StdAfx.h): #include <mfidl.h> #include <mfapi.h>   These are...
Introduction to TopoEdit
11 March 11 05:33 PM | pavely | with no comments
In Windows Media Foundation, TopoEdit is the equivalent of DirectShow’s GraphEdit tool. Using a simple graphic interface, one can build topologies (the equivalent of a DirectShow filter graph), and “run” them, that is, start the flow of data, from a source node towards one or more output nodes. We’ll see that in a minute. To open TopoEdit, the Windows SDK should be installed. Navigate using Windows Explorer to something like C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin and run TopoEdit.Exe. You...
More Posts Next page »