Can I use former Win32 APIs existing since Visual C++ 6.0, .net framework 2.0/3.0/3.5/4 namespace in Metro style APP
Wednesday, March 21, 2012 12:16 PM
I want to publish a metro style APP, but when I read http://msdn.microsoft.com/en-us/library/windows/apps/hh694083, that is "Certification requirements for Windows apps", I noticed item "3.1 Your app must use only APIs for Metro style apps".
Does that mean, if I write a metro style app in C#, in order to publish the App, I cannot use "DllImport" to use any former Win32 C++ APIs existing since Visual C++ 6.0; or I cannot add any former .net framework (2.0/3.0/3.5/4.0) dlls as references?
Does that mean the API used in Metro style App must be listed in http://msdn.microsoft.com/en-us/library/windows/apps/br211369.aspx, no matter I use "DllImport" or "Add reference" to use former Win32 C++ APIs or former .net framework dlls?
Or I can use part of these former APIs or dlls, only what I do is to verify whether it's Okay by using "Windows App Cert Kit"?
Wednesday, March 21, 2012 7:17 PMModerator
You are correct that you cannot use WIN32 API's in a store application as mentioned. The API's used must fall within the category listed.
Thursday, March 22, 2012 1:06 AM
The first question is: I cannot use .net framework 2.0/3.0/3.5/4.0 either, am I right?
The second question is: If I have former C++ dlls based on Win32 API, or C# dlls based on .net 2.0/3.0/3.5/4.0, I cannot use them by DllImport or Add reference. The correct way is I have to create Windows Metro style C++/C# library, listed in VS2011 Beta, and then re-write code.
Metro style App can only DllImport or Add reference Metro style library/dlls.
Am I right?
Thursday, March 22, 2012 2:50 AM
It looks like you've posted essentially the same question in many places. Please post it only once.
Metro style apps can use only the .Net Framework for Metro style apps, which is a subset of the full .Net 4.5 framework. They cannot use earlier versions of the framework.
Metro style apps can p-invoke Win32 DLLs so long as the DLLs use only API which are available to Metro style apps. Calling API from a DLL counts the same as if you called them from your app itself. While you can bypass the compile-time restrictions intended to help you avoid disallowed API, the app will still fail certification.
See Win32 and COM for Metro style apps for the list of available API. Your app will not pass certification if it tries to use them. SeeHow to test your app with the Windows App Certification Kit for instructions on testing if your app will pass certification locally.
_tcscmp and _tcscpy are part of the C-runtime and are not Win32 API. The WinSock2 API are part of the Win32 Desktop Family and are not available to Metro style apps. If you include them in your DLL then your app won't pass certification. I suspect that the VC6 runtime libraries won't pass certification, but you can test that with the cert kit. It may depend on what in them you call. You may need to recompile the DLL with VS11.
- Marked As Answer by John-P Thursday, March 29, 2012 3:18 PM
Thursday, March 22, 2012 5:36 AM
Thanks a lot!
I just tested my App today with Windows App Certification Kit and found lots of Win32 APIs were reported as unsupported in Metro style APP. Now as you mean, I think most of Win32 APIs (APIs can be used in Win32 desktop Apps: windows, threads, sockets, file ops, etc) and many of WPF/Silverlight APIs will not be supported.
For other APIs, such as C-runtime, part of Win32 APIs, .net 2.0/3.0/3.5/4.0 DLLs, the best way to verify is to test by Windows App Certification Kit. If possible, I can recompile the DLL with VS11 and then test. If it reports as failed, I think I have to re-write the DLL with supported APIs, if it succeeds, then it's a good news.And I think recompile the DLLs with VS11 may try to use latest .net framework or runtime or dependencies. In this case, the recompiled DLLs might pass the certification.
- Edited by Dongjjing Thursday, March 22, 2012 5:45 AM