Results 1 to 6 of 6
  1. #1
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Store Filenames in database from Explorer (VB6)

    I have a requirement to store filenames and paths in an Access database.
    The code to write the data in is very simple.
    However it is needed to be activated from within explorer.
    How easy is it and can anyone give me any pointers (excuse the pun)
    as to
    1. Integrating a utility like this into the explorer window
    It happens all the time with applications like winzip etc
    2. Getting it to recognize the file path and name from this location.

    If I was writing it from within the database it would be simple.

    Thanks
    Andrew

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Store Filenames in database from Explorer (VB6

    I think you're looking for documentation on creating a Shell Extension. Not something I've ever programmed, although I have read about it from time to time.

  3. #3
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Store Filenames in database from Explorer (VB6)

    Rule #1. The registry is your friend.
    Rule #2. To really customize windows, you must modify the registry
    Rule #3. If Rules 1 and 2 mess up your machine, you can always reinstall the OS. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Okay, seriously, one of the reasons I love the Lounge is because I always find a post that let's me just plain experiment. Here's how to do what you want. Take your VB .exe. I wrote a simple one like this:

    Sub Main()
    msgbox """" & Command & """"
    End Sub

    I called it filetest.exe, and compiled it to the root of my C: drive.

    Then, go into your registry (and here is where all warranties and promises go away, do this at your own risk! <img src=/S/wink.gif border=0 alt=wink width=15 height=15>). Find HKEY_CLASSES_ROOTAllFilesystemObjects
    If there is not a key called 'shell' (no quotes), then add it. Under the new (or old) shell key, add a new key with the name of the text you want displayed at the top of the 'right click' shortcut menu. In my instance, I used Test VB. Then add a key under that new key called 'Command' (no quotes). In the default value of that key, I put 'C:filetest.exe *1' (again, no quotes, and replace the * asterick with a percent symbol. It's not posting on the lounge right, so I had to change it!). Now, on every file and folder in Windows explorer, I get a Test VB option in my shortcut menu. Clicking on it displays the full path of the file/folder I am over.

    So, in summation, you would have this displayed in regedit:

    HKEY_CLASSES_ROOT
    AllFilesystemObjects
    shell
    Your Custom Process Name
    Command

    Hope this helps. <img src=/S/sailing.gif border=0 alt=sailing width=25 height=25>

  4. #4
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Store Filenames in database from Explorer (VB6)

    AWESOME!

    And so simple too.
    I've been trawling books about shell programming in VB and C++ (Nightmare)
    They have long solutions that involve assorted API function calls.

    But this is such a neat answer.
    And all I needed, from that return string I can get all the information I need.


    Many Thanks.
    Andrew

  5. #5
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Store Filenames in database from Explorer (VB6)

    Andrew

    Along similar lines to Drew's reply, there are numerous utilities around that can do the registry "dirty work" for you, when adding to Explorer's context menu. For example:

    CONTEXT MENU EXTENDER.......... CMenuExtender is a shell extension that lets the user add items to the Explorer context menu. Using any registry-editor or the supplied GUI, the user can add submenus and items such as shortcuts to programs, documents, folders, webpages and scripts. CMExt also has some predefined commands for copying, moving and retrieving information on files and directories..... <img src=/S/free.gif border=0 alt=free width=30 height=15>.....!


    Alan

  6. #6
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Store Filenames in database from Explorer (VB6)

    No problem, glad it helped.

Posting Permissions

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