Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Launching Store App from .Net

$
0
0

Hi,

I have a WPF desktop application, I'm trying to launch windows store app from .Net/Wpf application. 

I've tried following code:

 [ComImport]
    [Guid("45BA127D-10A8-46EA-8AB7-56EA9078943C")]
    public class ApplicationActivationManager : IApplicationActivationManager
    {
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
        public extern IntPtr ActivateApplication([In] String appUserModelId, [In] String arguments, [In] ActivateOptionsEnum options, [Out] out UInt32 processId);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
        public extern IntPtr ActivateForFile([In] String appUserModelId, [In] IntPtr itemArray, [In] String verb, [Out] out UInt32 processId);

        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
        public extern IntPtr ActivateForProtocol([In] String appUserModelId, [In] IntPtr itemArray, [Out] out UInt32 processId);
    }






const string appUserModelId = "DefaultBrowser_NOPUBLISHERID!Microsoft.InternetExplorer.Default";

var appActiveManager = new ApplicationActivationManager();

uint pid;

appActiveManager.ActivateApplication(appUserModelId, null, ActivateOptionsEnum.None, out pid);

The "appUserModelId" value is taken from registry entry.

In above code, I get "An unhandeled exception of type 'System.AccessViolationException' occurred in Client.Console.exe" exception at appActiveManager.ActivateApplication().

what does this exception indicate, in general?

how may i solve this exception? 

Thanks.




Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>