May 21st, 2026
0 reactions

How do I use Win32 structures from the Windows Runtime?

The Windows Runtime attempts to provide a language-independent interface for Windows APIs: The ABI is consistent across the Windows Runtime, and the APIs themselves are described via metadata, allowing each language to map the Windows Runtime concepts into concepts that are more natural for each target language. For example, the Windows Runtime DateTime maps to a corresponding date-time type for each target language, like std::chrono::time_point for C++ or Date for JavaScript. A cost of this goal is that the expressiveness of the Windows Runtime is constrained by the desire to make all the features available to all languages. For example, there are no raw pointers in the Windows Runtime.

Win32 structures defined in classic C/C++ header files are not part of the Windows Runtime. So in a literal sense, you can’t use them from the Windows Runtime.

But you can fake it.

You can declare a shadow structure in the Windows Runtime that has the same layout as the classic Win32 structure you want to use. For example, you could declare your own Win32Point structure:

struct Win32Point
{
    Int32 X;
    Int32 Y;
};

Note that the Windows Runtime has its own conventions for some things that in Win32 are represented by structures. For example, the PROPERTYKEY structure is represented conventionally in the Windows Runtime in its string form. You can use functions like PSPropertyKeyFromString and PSStringFromPropertyKey to convert between them.

Topics

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments