Results 1 to 5 of 5

Thread: Windows-E, shelling to explorer, specifying the folder

  1. #1

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Windows-E, shelling to explorer, specifying the folder

    Here's a bit of a puzzler. But first, I need to outline a bit of how my main application works.

    When describing it, I often tell people that there's a front-end (the VB6 program), and two back-ends (soon to be three).

    The first back-end is a MS-Access database, and it's not concerned here.

    The second back-end is a group of files for each person tracked in the database (i.e., the MS-Access database). The front-end maintains an extensive file-system folder tree-structure. I'd show a screen-shot, but I can't do that because of privacy issues. Just imaging a root folder on some LAN file-server named "People". And then, under that, there are many sub-folders with ID numbers for these people. And, there are further sub-folders (and sub-sub-folders) within these numbered folders.

    (And, just as an FYI, the third back-end is where multiple sites will be feeding data into an Oracle server over a WAN).

    But back to the folders and sub-folders. On many of the front-end's forms, there's a button named "Explore". You click this button, and a Windows Explorer pops open so you can directly see the files for that person. I just do that with a simple Shell...

    Code:
    
        Shell "Explorer """ & sGotoThisPath & """", vbNormalFocus
    
    Now, here's the problem. Many of my users are familiar with the ability to press Windows-E to get a copy of Windows Explorer open. However, when you do this, it typically goes to "Quick Access". Here's what I'd like...

    If one of my forms with that "Explore" button has the focus, and the user presses Windows-E, I'd like Windows Explorer to open in the same place as if they'd clicked my button.

    Any ideas?
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  2. #2
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,651

    Re: Windows-E, shelling to explorer, specifying the folder

    Could it be stopped in a low level keyboard hook? (SetWindowsHookEx(WH_KEYBOARD_LL)). Intercept, dismiss, then normal shell.

    Windows seems to make it really hard to intercept Windows+key shortcuts from 7 on... maybe if you could at least detect it? If you could detect it, and it opens a new explorer window on top of everything... you could find the topmost hwnd, then scan through open file browses (ShellWindows object), and if the hwnd matches navigate it to where you want it.

  3. #3
    Hyperactive Member
    Join Date
    Jun 2016
    Location
    España
    Posts
    506

    Re: Windows-E, shelling to explorer, specifying the folder

    you can use an AutoHotkey script to capture the key and open the browser in the folder
    Code:
    #NoTrayIcon
    #Persistent
    #SingleInstance, Force
    #e:: Run explorer.exe D:\
    more info
    Customize the [Windows]+E

  4. #4
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: Windows-E, shelling to explorer, specifying the folder

    AHK uses low level keyboard hooks

  5. #5

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Windows-E, shelling to explorer, specifying the folder

    Hmmm, I think I'll let this ferment for a while. This was just a request, and it sounded "fun".

    I don't think it's reasonable to tell my users to go buy another piece of software, just for this. Also, the actual folder I'm trying to open changes all the time, depending on what my VB6 program is doing.

    The SetWindowsHookEx(WH_KEYBOARD_LL) seems like it might have possibilities. I might play around with that. For it to do what I want, I'd have to set/unset the hook when my windows were activated/deactivated; but that's probably not a problem.

    EDIT1: Hmmm, actually, I'd also need to build a universal (beyond my program) activate/deactivate event. Or, maybe I should just have flags that say whether or not I do anything. I'll "play" and report back.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width