none
IMetroMode is obsolete in Win8 RC

    Question

  • Hi,

    I've upgraded to Windows 8 RC build 8400 + VS Pro 2012 RC

    I see that there is no more IMetroMode 

    I'm trying to use IExecuteCommandHost instead (call GetUIMode)  using CLSID_AppVisibilty (couldn't find CLSID_ExecuteCommandHost) and it fails in CoCreateInstance

    Thanks,

    Haim.

    My code is:

    IExecuteCommandHost *pImmersiveMode = NULL;

    HRESULT hr = CoInitializeEx(NULLCOINIT_MULTITHREADED);// COINIT_APARTMENTTHREADED - doesn't work

    if(FAILED(hr))

    {

    return EMS_Invalid;

    }

    hr = CoCreateInstance(CLSID_AppVisibility, nullptrCLSCTX_INPROC_SERVERIID_PPV_ARGS(&pImmersiveMode));

    if(FAILED(hr))

    {

    return EMS_Invalid;

    }


    Sunday, June 03, 2012 11:44 AM

Answers

  • I think next code should work:

    {

    #if (VER_PRODUCTBUILD >= 8400)

    IAppVisibility *pImmersiveMode = NULL;

    #else

    IMetroMode *pImmersiveMode = NULL

    #endif

    if(NULL == pImmersiveMode)

    {

    // Create the immersive mode component

    HRESULT hr = CoInitializeEx(NULLCOINIT_MULTITHREADED);

    if(FAILED(hr))

    return EMS_Invalid;

    #if (VER_PRODUCTBUILD >= 8400)

    hr = CoCreateInstance(CLSID_AppVisibility, nullptrCLSCTX_INPROC_SERVERIID_PPV_ARGS(&pImmersiveMode));

    #else

    hr = CoCreateInstance(CLSID_MetroMode, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pImmersiveMode));

    #endif

    if(FAILED(hr))

    return EMS_Invalid;

    }

    I have a question regarding the meaning of GetAppVisibilityOnMonitor

    What is the description of next monitor modes: MAV_APP_VISIBLEMAV_UNKNOWN, MAV_NO_APP_VISIBLE

    Thanks

    Haim

    Tuesday, June 05, 2012 6:38 AM
  • The document does not updated to have those APIs descriptions, I just know those APIs from this sample code: http://code.msdn.microsoft.com/windowsdesktop/Start-screen-visibility-b1a72059#content

    I think this function is what you wanted.


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us


    Tuesday, June 05, 2012 8:46 AM

All replies

  • I've exactly the same problem. IMetroMode is no longer defined in Shobjidl.h

    Martin

    Monday, June 04, 2012 1:16 PM
  • I think next code should work:

    {

    #if (VER_PRODUCTBUILD >= 8400)

    IAppVisibility *pImmersiveMode = NULL;

    #else

    IMetroMode *pImmersiveMode = NULL

    #endif

    if(NULL == pImmersiveMode)

    {

    // Create the immersive mode component

    HRESULT hr = CoInitializeEx(NULLCOINIT_MULTITHREADED);

    if(FAILED(hr))

    return EMS_Invalid;

    #if (VER_PRODUCTBUILD >= 8400)

    hr = CoCreateInstance(CLSID_AppVisibility, nullptrCLSCTX_INPROC_SERVERIID_PPV_ARGS(&pImmersiveMode));

    #else

    hr = CoCreateInstance(CLSID_MetroMode, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pImmersiveMode));

    #endif

    if(FAILED(hr))

    return EMS_Invalid;

    }

    I have a question regarding the meaning of GetAppVisibilityOnMonitor

    What is the description of next monitor modes: MAV_APP_VISIBLEMAV_UNKNOWN, MAV_NO_APP_VISIBLE

    Thanks

    Haim

    Tuesday, June 05, 2012 6:38 AM
  • The document does not updated to have those APIs descriptions, I just know those APIs from this sample code: http://code.msdn.microsoft.com/windowsdesktop/Start-screen-visibility-b1a72059#content

    I think this function is what you wanted.


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us


    Tuesday, June 05, 2012 8:46 AM
  • Thank you very much. Your code has pointed me to the updated "Start screen visibility example"

    http://code.msdn.microsoft.com/windowsdesktop/Start-screen-visibility-b1a72059

    Thanks

    Martin

    Tuesday, June 05, 2012 8:47 AM
  • You're welcome!

    Have a good day!


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, June 06, 2012 10:39 AM