

Windows 8 Runtime reference and sample code [MSDN] - pcj
http://msdn.microsoft.com/en-us/library/windows/apps/br211377

======
pcj
Sample Code - <http://code.msdn.microsoft.com/windowsapps>

------
pavlov
This really is a completely new user-level API. There's no trace of
traditional Win32 concepts: no window handles, no window classes, no event
loop... (Yes, no more WPARAM and LPARAM either. Goodbye 1985!)

For years Microsoft has been trying to come up with a successor for Win32.
This looks like the most credible attempt yet.

I don't think this API will be accessible from standard C/C++, though. All the
code samples require Microsoft's C++/CLI dialect.

For example, here's what _main.cpp_ looks like for one of the app samples that
uses a Direct3D view:

    
    
      #include "DirectXViewProvider.h"
    
      [Platform::MTAThread] 
      int main(array<Platform::String^>^) 
      { 
          auto directXViewProviderFactory = ref new DirectXViewProviderFactory(); 
          Windows::ApplicationModel::Core::CoreApplication::Run(directXViewProviderFactory); 
          return 0; 
      }
    

It's certainly a great improvement over the old WinMain() and running your own
event loop. However, those ^ symbols indicate managed CLI objects. When these
are even in the main() function signature, it suggests that C++/CLI is a hard
requirement.

I'm not sure how this will affect other compilers on Windows. AFAIK, Visual
C++ is the only compiler with C++/CLI compatibility. Will it be impossible to
build full apps using GCC on Windows 8?

~~~
pavlov
To answer my own question... It appears that even though this code looks and
quacks like C++/CLI, it actually isn't:

 _"In this example, you will immediately notice some keywords that are not
part of standard C++. Visual C++ defines a few Component Extensions that, in a
Metro style app,are essentially syntactic sugar over the underlying COM calls
involved in creating and consuming Windows Runtime types._

 _"If you are familiar with C++/CLI, you will notice that the Component
Extensions look very similar to C++/CLI syntax. However, in a Metro style app
or Windows Runtime component, all the C++ code is native. The /Zw compiler
option causes the Component Extensions to be compiled for Windows Runtime. The
/cli compiler option causes them to be compiled for C++/CLI. Currently,
C++/CLI is not supported for Metro style apps."_

(Source: [http://msdn.microsoft.com/en-
us/library/windows/apps/hh45407...](http://msdn.microsoft.com/en-
us/library/windows/apps/hh454076\(v=VS.85\).aspx) )

I'm fairly confused now. So they've added a compiler extension in Visual C++
v11 that compiles this C++/CLI look-a-like syntax into traditional COM types
and calls? If so, that's good news for other compilers, I guess.

------
billforsternz
Am I the only dev in the world who doesn't know what a "Metro style app" is ?
Trying to find out what a metro style app actually is on MSDN is a frustrating
exercise. It's annoying when any organization invents new terminology and then
acts as if it is a fundamental part of the language.

~~~
barista
When it comes to the design, here you can find what its supposed to look like:
[http://www.microsoft.com/design/toolbox/tutorials/windows-
ph...](http://www.microsoft.com/design/toolbox/tutorials/windows-
phone-7/metro/)

------
BonoboBoner
Samples are available in C++, C# and..... JS. Never would have thought to see
that happen.

