Results 1 to 10 of 10

Thread: Reading From a Shortcut

  1. #1

    Thread Starter
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    865

    Reading From a Shortcut

    Does Anyone know a Way of reading from a Shortcut File (.lnk) ? or Does anyone know the Format of shortcuts (.lnk). I have Tried the windows script host object model COM Component But I can't Get It To Work.

    Thanks in Advance,
    BlindSniper

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  2. #2
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    Re: Reading From a Shortcut

    Can you show us your code?

  3. #3

    Thread Starter
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    865

    Re: Reading From a Shortcut

    I followed quite a few examples on the net and you couldn't even paste the code into Visual studio without getting errors and I looked around in the component there was nothing i could make heads or tails of but i'll try And Paste code in a few Minutes

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  4. #4

    Thread Starter
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    865

    Re: Reading From a Shortcut

    OK i Figured out how to create A shortcut But that Doesn't help a lot (yet). I need to read all the data from an existing shortcut which isn't possible with the windows script host object model(as far as i can see).

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  5. #5
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    Re: Reading From a Shortcut

    Quote Originally Posted by BlindSniper View Post
    OK i Figured out how to create A shortcut But that Doesn't help a lot (yet). I need to read all the data from an existing shortcut which isn't possible with the windows script host object model(as far as i can see).
    Hang in there I am uploading one for you.

  6. #6
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    Re: Reading From a Shortcut

    The attached project uses code from another developer to read/write shortcuts. I created the project in VS2005 and just upgraded it to VS2008, tested it as is on Windows Vista.

    Try it out, it will recurse thru the start menu, quick launch and desktop looking at all shortcuts and logging the information to a textfile which is opened after the recursive ops are done. Empty shortcuts are ignored, ability to change is commented out. About the only issue I can think of is authority to read the files which I didn't have issues with on Windows XP or Vista.

    The key to read a shortcut with the code used
    Code:
            Dim Shortcut As MSjogren.Samples.ShellLink.VB.ShellShortcut = _
                New MSjogren.Samples.ShellLink.VB.ShellShortcut(FileName)
    Where FileName is the full path and shortcut file name concatenated together.

  7. #7

    Thread Starter
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    865

    Re: Reading From a Shortcut

    Thanks Will Give it a try

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  8. #8
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    Re: Reading From a Shortcut

    Quote Originally Posted by BlindSniper View Post
    Thanks Will Give it a try
    Make sure to explore the code modules as there is more there than I demo'd possible.

  9. #9

    Thread Starter
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    865

    Re: Reading From a Shortcut

    Ok I got It Working Thank you very much! . One More little Off Topic Question : Wouldn't it be easier to just read the bytes from the shortcut and Populate the properties from there ? It Seems a Bit overkill as it is But i'm not complaining It works

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  10. #10
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    Re: Reading From a Shortcut

    Quote Originally Posted by BlindSniper View Post
    Ok I got It Working Thank you very much! . One More little Off Topic Question : Wouldn't it be easier to just read the bytes from the shortcut and Populate the properties from there ? It Seems a Bit overkill as it is But i'm not complaining It works
    Well let's put it this way, the code offers a lot which is no different than internal libraries. Good to hear the code worked for you.

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