locked
Avoiding app minimize RRS feed

  • Question

  • Hi,

    I'm developing a dashboard user interface using C#/Xaml Store app.

    One of the requirement is that app should not be minimized or switched into the background.

    Pressing Alt+Tab key user should switch from Store App to the Desktop, but pressing window key shouldn't minimize this store app.

    I've tried Window.Current.VisibilityChanged event but it doesn't help.

    is there any way to achieve above requirement?

    Thanks.

    Tuesday, November 18, 2014 8:31 PM

Answers

  • no there isnt. if use navigates away you cant stop this

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, November 18, 2014 8:51 PM
  • nope.. such api's are not avaiable for store apps

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, November 18, 2014 9:44 PM
  • ApplicationActivationManager is the right way to launch a Windows Store app from a desktop app. For help with how to create and call a COM object from a desktop .Net app you should post in the .Net forums.

    If you are trying to create a Kiosk-type scenario where your app is the only one that runs then look at the Assigned Access feature. This is a system setting which allows setting up an account to run only the assigned app. For help with this please post in the TechNet Windows 8.1 IT Pro forums.

    Wednesday, November 19, 2014 1:06 AM
    Moderator
  • You don't need to do anything beyond deploying the app. You don't need to (and shouldn't) muddle directly with the registry.

    Are you creating an appx package and deploying it or are you just running from in Visual Studio?

    My guess is that you don't have the right appUserModelId.

    • Proposed as answer by Dhruvesh Thursday, November 20, 2014 1:59 AM
    • Marked as answer by Jamles HezModerator Monday, December 1, 2014 6:22 AM
    Thursday, November 20, 2014 12:18 AM
    Moderator

All replies

  • no there isnt. if use navigates away you cant stop this

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, November 18, 2014 8:51 PM
  • Thank you for the answer.

    Can I ignore Window key press in store app? 

    by using some low level message hook to ignore window key press on the active window?

    Tuesday, November 18, 2014 9:43 PM
  • nope.. such api's are not avaiable for store apps

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, November 18, 2014 9:44 PM
  • Ok,

    only problem is that if user accidentally presses window key then it would minimize the app.

    is there any elegant way or standard practice to handle this situation?  

    Tuesday, November 18, 2014 9:51 PM
  • well .. like said .. preventing is impossible.. so make sure you app works nice like saving state but dont see what other things are not working for you

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, November 18, 2014 9:53 PM
  • Ok, I'll work around this.


    I have a WPF desktop application, I need help with launching the 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().

    Is there any other way to launch the app from .Net application?

    Thanks.



    • Edited by Dhruvesh Tuesday, November 18, 2014 10:34 PM
    Tuesday, November 18, 2014 10:29 PM
  • Use protocol activation? Implement a protocol in your app and navigate from your wpf to that protocol?

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, November 18, 2014 10:43 PM
  • Thanks Dave.
    Tuesday, November 18, 2014 10:50 PM
  • ApplicationActivationManager is the right way to launch a Windows Store app from a desktop app. For help with how to create and call a COM object from a desktop .Net app you should post in the .Net forums.

    If you are trying to create a Kiosk-type scenario where your app is the only one that runs then look at the Assigned Access feature. This is a system setting which allows setting up an account to run only the assigned app. For help with this please post in the TechNet Windows 8.1 IT Pro forums.

    Wednesday, November 19, 2014 1:06 AM
    Moderator
  • Hi,

    I have developed a Store App and deploying on local machine.

    I can launch Travel, Maps an other store apps from .Net app using ApplicationActivationManager::ActivateApplication().

    ActivateApplication() needs appUserModelId from HKEY_CURRENT_USERSoftwareClassesActivatableClassesPackage.

    I don't have my store app under HKEY_CURRENT_USERSoftwareClassesActivatableClassesPackage. 

    To launch my store app, do I have to register my app with local registry? if yes, How can I make my store app available under HKEY_CURRENT_USER..?

    Is there any easy way to launch the store app from .Net app without using registry entry's appUserModelId?

    Thanks,


    • Edited by Dhruvesh Wednesday, November 19, 2014 6:09 PM
    Wednesday, November 19, 2014 6:09 PM
  • You don't need to do anything beyond deploying the app. You don't need to (and shouldn't) muddle directly with the registry.

    Are you creating an appx package and deploying it or are you just running from in Visual Studio?

    My guess is that you don't have the right appUserModelId.

    • Proposed as answer by Dhruvesh Thursday, November 20, 2014 1:59 AM
    • Marked as answer by Jamles HezModerator Monday, December 1, 2014 6:22 AM
    Thursday, November 20, 2014 12:18 AM
    Moderator
  • That's correct! There's no need to access registry on target machine.

    Hard coded app name works on target machine as well and launches the app correctly. 

    Thanks.

    Thursday, November 20, 2014 1:59 AM