I'm packing a Win32 app coded by C++ into a MSIX package and trying to publish at Microsoft app store. My app has in-app products to let users purchase.
The app is coded in classic Win32 API in C++ and the in-app purchase module is coded by Windows Runtime with C++/CX and compiled by "/ZW" (Windows Runtime Compilation) options.
The in-app purchase is done by calling RequestPurchaseAsync().
Since I use desktop bridget to consume Windows Rumtime in Win32 app, I carefully following the following resource to make sure:
your application must configure the StoreContext object to specify which application window is the owner window for modal dialogs that are shown by the object.
https://learn.microsoft.com/en-us/windows/uwp/monetize/in-app-purchases-and-trials#desktop
I have applied all related code (IInitializeWithWindow) in my code by following the sample code in this link:
https://learn.microsoft.com/en-us/answers/questions/2105663/issues-with-requestpurchaseasync-in-mfc-c-applicat
The result I got:
- if my Win32 app is packed as appContainer app, then RequestPurchaseAsync() crashes with "HRESULT:0x80070578 Invalid window" exception.
- if Win32 app is packed as full-trust app, then RequestPurchaseAsync() works and the modal dialog shows up to allow user to purchase product.
I use the following attributes in my WAP project (.wapproj) file to make my MSIX package either a container based app or a full-trust app. "Partial" to pack as container app and "Full" to pack as full-trust app. The related resource is at:
https://learn.microsoft.com/en-us/windows/msix/msix-container
<ProjectReference Include="..\MyWin32App.vcxproj">
<TrustLevel>Partial</TrustLevel>
</ProjectReference>
My Question is:
How can I pack my Win32 app as appContainer app while store service works well without raising "HRESULT:0x80070578 Invalid window" exception?
When a submitted app is being evaluated, a full-trust app needs to provide further explanation about why the app need to use "runFullTrust" permission. That is why I prefer packing my app as container app.
By the, following shows the permissions in Package.appxmanifest file to make app packed as full-trust app:
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
Thanks for any suggestions.
Hongkun Wang