How to check if VB6 program is running as shell?



  • How do you make a program with VB6 so that it will check if it is running as the shell, and modify some of its behaviours if it is? Also, how to make it so when it is running as the shell, it can capture some key combinations with the Windows logo key together with other keys that does some things, no matter which programs is currently active, such as WIN+D to maximize and focus this program and minimize all others (this won't interfere with Explorer because it is only supposed to do that when it runs as the shell and other programs such as Explorer isn't)


  • ♿ (Parody)

    I have no idea.  But once you get a VB6 based shell, please let us know, because that's TRWTF.



  • As for the second question, try the [url=http://msdn2.microsoft.com/en-us/library/ms646309.aspx]RegisterHotKey[/url] function, but beware that "Keyboard shortcuts that involve the WINDOWS key are reserved for use by the operating system".



  • Not being a windows-y VB-y guy, can't say for certain, but this page tells you how to get hold of your parent process - presumably, that'd be cmd.exe if you launched from the shell, rather than explorer.exe if you launched from the GUI. HTH



  • @Benn: Windows explorer when it generates the start bar below is referred to as the shell, cmd.exe and command.com are no longer referred to as shells. TRWTF is that MS renames half of the components every desktop OS.



  • @Lingerance said:

    @Benn: Windows explorer when it generates the start bar below is referred to as the shell, cmd.exe and command.com are no longer referred to as shells. TRWTF is that MS renames half of the components every desktop OS.

    Right - my last Windows project was on 98...praise be :)



  • @Benn said:

    Right - my last Windows project was on 98...praise be :)
    Lucky you.



  • Can it be done by using RegisterHotKey to check if the hotkeys are already registered by the shell, if they already are, then my program isn't the shell? Will that work? Also, it requires message send to a window, how do you make it receiving the hotkey messages? Can it be by create usercontrol? (I have used CreateWindow API function in a VB usercontrol to create a Unicode textbox in VB6, but I can't receive window messages using that) But I think I read it somewhere that it has to be a normal code module not a class module. I am still confused a bit how to do it



  • Forgot this the last time... of course, the real WTF is VB6. AFAIK, even it's extended support period has expired. Switch to VB 2008 as fast as you can. (And you'll get Unicode for free, yay!)



  • Free unicode?  Where do I sign?!? 


Log in to reply