Windows 8 - Start MetroUI from desktop

Windows specific forum
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Windows 8 - Start MetroUI from desktop

Post by GeoTrail »

I'm working on a small utility and I need to be able to launch the Windows 8 Metro UI from the Desktop. I was thinking something like sending a keyboard shortcut or something, but I can't find any info on this.

Does anyone have a clue how I can launch the Metro UI from the Desktop? It needs to work even if a thirdparty Startmenu program is installed.
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Windows 8 - Start MetroUI from desktop

Post by Danilo »

Code: Select all

Procedure OpenStartMenu()
    keybd_event_(#VK_CONTROL,0,0,0)                ; press   CTRL key
    keybd_event_(#VK_ESCAPE ,0,0,0)                ; press   ESC  key
    keybd_event_(#VK_ESCAPE ,0,#KEYEVENTF_KEYUP,0) ; release ESC  key
    keybd_event_(#VK_CONTROL,0,#KEYEVENTF_KEYUP,0) ; release CTRL key
EndProcedure

OpenStartMenu()
Works here, but don't know if some 3rd party start menus catch this message with a keyboard hook.
It is CTRL+ESC, see Complete list of Windows 8 shortcuts
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Re: Windows 8 - Start MetroUI from desktop

Post by GeoTrail »

Thanks for the reply :)
Unfortunantly that don't work with most 3rd party start menus as they catch the keyboard combo and opens the 3rd party startmenu instead.
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Windows 8 - Start MetroUI from desktop

Post by Danilo »

Another way, but not so good:

Code: Select all

Procedure OpenStartMenu()
    PostMessage_(#HWND_BROADCAST,#WM_SYSCOMMAND,#SC_TASKLIST,0)
EndProcedure

OpenStartMenu()
Best way I found seems to be by using a .vbs script, which I create in TEMP here:

Code: Select all

Procedure.i OpenStartMenu()
    ;
    ; .vbs script from thread @ http://www.7tutorials.com/download-shortcut-windows-8-start-screen-desktop
    ;
    Protected file
    Protected tempFileName.s = GetTemporaryDirectory()+"$tmp"+Hex(Random(-1))+".vbs"

    file = CreateFile(#PB_Any, tempFileName)
    If file
        WriteStringN(file, "Set objShell = CreateObject("+#DQUOTE$+"WScript.Shell"+#DQUOTE$+")")
        WriteStringN(file, "objShell.SendKeys "+#DQUOTE$+"^{ESC}"+#DQUOTE$)
        FlushFileBuffers(file)
        CloseFile(file)
        ;Delay(50)
        RunProgram(tempFileName,"","",#PB_Program_Wait|#PB_Program_Hide)
        ;Delay(50)
        DeleteFile(tempFileName)
        ProcedureReturn #True
    EndIf
    ProcedureReturn #False
EndProcedure

OpenStartMenu()
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Re: Windows 8 - Start MetroUI from desktop

Post by GeoTrail »

The first one worked great even with a thirdparty startmenu installed.
The second one with the VB script only opened the start menu.
Seems the first option is going to work perfect for me.
Thanks a million Danilo :) :mrgreen:
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Re: Windows 8 - Start MetroUI from desktop

Post by SFSxOI »

Windows 8, the operating system its self, is great, however, the GUI is like it was designed by a bunch of circus clowns on crack for those who are not power users.
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Windows 8 - Start MetroUI from desktop

Post by IdeasVacuum »

SFSxOI wrote:Windows 8, the operating system its self, is great, however, the GUI is like it was designed by a bunch of circus clowns on crack for those who are not power users.
Huh? They must of made some serious improvements since the Beta then :mrgreen:
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Re: Windows 8 - Start MetroUI from desktop

Post by GeoTrail »

I was, honestly, one of the biggest sceptics when I first tested an alpha version of Win8. But after using it on my 6 year old mini laptop with a single core 1.6GHz atom CPU with 1GB of RAM, I am convinced that this is the best Windows so far. It is super optimized and very fast.
Yes, the Metro UI gave me nightmares for a long time, but I'm getting used to it. But, that said, I do have Stardock Start8 on all my computers now, so they basically all work and look almost the same as Windows 7.
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
User avatar
skywalk
Addict
Addict
Posts: 4242
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Windows 8 - Start MetroUI from desktop

Post by skywalk »

That is encouraging. I heard Windows 8 is tighter but no chance yet to try.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Re: Windows 8 - Start MetroUI from desktop

Post by GeoTrail »

Yeah it does feel tighter. Like it's better "screwed together" in car-terms hehehe
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
Post Reply