In the Microsoft world, there are multiple platforms. Each has its own API. WinRT has it's own API, distinct from other MS platforms, not to mention non-MS platforms. Back in the 90s, there were utopian ideas about such code sharing. I've never seen anything like it remotely come to reality.
I do most of my coding on the MS .NET Framework in the C# and VB.NET languages. Yet with WinRT, I get to keep using those two languages, but the technology under the hood is COM based. That means there is a extra layer to utilize the .NET languages I am familiar with.
Then there is the issue that WinRT (Metro UI) apps have a difference way of UI layout than regular Windows desktop apps. In the popup message example, it wouldn't even have the same library, let alone the same method name.
Bottom line: to port any existing Windows app to WinRT is a major retooling. The only code that might salvageable would be non-visual, non-IO code. And that assumes the same libraries can be used. MS has stated an app could be rejected from the Windows Store if it uses the wrong APIs. This follows Apple's policy in their App Store.