Go Back   Forum Care Forums > Development Reference Area > Visual Basic

Reply
 
LinkBack Thread Tools Display Modes
ShellLinkObject --> GetIconLocation (return path AND index)
Old
  (#1)
Bob
Guest
 
Posts: n/a
Default ShellLinkObject --> GetIconLocation (return path AND index) - 06-04-2007, 08:50 AM

Hi !
I got a problem here ... i used a ShellLinkObject is retrive some data from
..lnk files (path to execute, working directory, etc ...) but i need to get
the icon path (in some case this is the same as the exe, but this is not
always this !).
I found the function GetIconPath, but this is returning only the "icon
index" in the file (exe, dll), I need the path too, specially if the icon
path is an .ico file.

Here is a sample of my code, thank's for helping guys :P
- Bob

Private shlIcon As Shell
Private fldIcon(10) As Folder
Private fileIcon(10, 50) As FolderItem
Private lnkIcon(10, 50) As ShellLinkObject
Private Const PATH_TO_SHELL = "D:\New Folder\"
Private pathIcon(10, 50) as String

Set shlIcon = New Shell
Set fldIcon(0) = shlIcon.NameSpace(PATH_TO_SHELL)

For i = 0 To fldIcon(0).Items.Count
' SET - fileIcon - lnkIcon
Set fileIcon(0, i) = fldIcon(0).Items.Item(i)
Set lnkIcon(0, i) = fileIcon(0, i).GetLink

' This returns: 0
pathIcon(0, i) = lnkIcon(0, i).GetIconLocation (0) '????
Next i


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: ShellLinkObject --> GetIconLocation (return path AND index)
Old
  (#2)
mayayana
Guest
 
Posts: n/a
Default Re: ShellLinkObject --> GetIconLocation (return path AND index) - 06-04-2007, 08:50 AM

I'm not certain this will help but it might:

According to my docs GetLink returns an IShellLinkDual
object - then there's no explanation of what that is. Maybe
ShellLinkObject is WinXP?
In any case, you can get an IShelllink interface directly,
skipping the Shell COM object, with the SHELLLNK cl***
that's in the tools\unsupported folder of the VB/VS CD.
I haven't used GetIconLocation but it's listed in MSDN
for the IShelllink interface:

long = GetIconLocation(s, Num, i)
in which s is a string buffer, Num (long) is max. number of
characters to copy into the buffer and i is a long variable to
receive the index. Returns 0 on success.

> Hi !
> I got a problem here ... i used a ShellLinkObject is retrive some data

from
> .lnk files (path to execute, working directory, etc ...) but i need to get
> the icon path (in some case this is the same as the exe, but this is not
> always this !).
> I found the function GetIconPath, but this is returning only the "icon
> index" in the file (exe, dll), I need the path too, specially if the icon
> path is an .ico file.
>
> Here is a sample of my code, thank's for helping guys :P
> - Bob
>
> Private shlIcon As Shell
> Private fldIcon(10) As Folder
> Private fileIcon(10, 50) As FolderItem
> Private lnkIcon(10, 50) As ShellLinkObject
> Private Const PATH_TO_SHELL = "D:\New Folder\"
> Private pathIcon(10, 50) as String
>
> Set shlIcon = New Shell
> Set fldIcon(0) = shlIcon.NameSpace(PATH_TO_SHELL)
>
> For i = 0 To fldIcon(0).Items.Count
> ' SET - fileIcon - lnkIcon
> Set fileIcon(0, i) = fldIcon(0).Items.Item(i)
> Set lnkIcon(0, i) = fileIcon(0, i).GetLink
>
> ' This returns: 0
> pathIcon(0, i) = lnkIcon(0, i).GetIconLocation (0) '????
> Next i
>
>



   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top