BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Resolving a shortcut

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
José
Guest





PostPosted: Fri Apr 21, 2006 10:03 am    Post subject: Resolving a shortcut Reply with quote



I read a file with the LNK extension. How to find the file it refers
to?
--
José
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Apr 21, 2006 11:03 am    Post subject: Re: Resolving a shortcut Reply with quote



"José" <jose (AT) 127 (DOT) 0.0.1> wrote in message
news:tk8h4252vqq8t5t08lkfpc9k20tb0gubom (AT) 4ax (DOT) com...

Quote:
I read a file with the LNK extension. How to find the
file it refers to?

Use the IShellLink interface to read/write .lnk files:

Shell Links

http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/shortcuts/shortcut.asp


Gambit
Back to top
José
Guest





PostPosted: Sat Apr 22, 2006 5:03 pm    Post subject: Re: Resolving a shortcut Reply with quote



On Fri, 21 Apr 2006 03:04:14 -0700, "Remy Lebeau \(TeamB\)"
<no.spam (AT) no (DOT) spam.com> wrote in borland.public.cppbuilder.nativeapi:

Quote:
I read a file with the LNK extension. How to find the
file it refers to?

Use the IShellLink interface to read/write .lnk files:

Shell Links

http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/shortcuts/shortcut.asp

It's pretty complicated. I am surprised that there is no such thing as
a simple function: String ResolveShortCut (String lnkfile);

Besides, I may be a dunce, but the function ResolveIt on the website
doesn't compile:

(190): E2451 Undefined symbol 'IShellLink'.
(198): E2268 Call to undefined function 'CoCreateInstance'.
(198): E2451 Undefined symbol 'CLSID_ShellLink'.
(199): E2451 Undefined symbol 'IID_IShellLink'.
(202): E2451 Undefined symbol 'IPersistFile'.
(205): E2451 Undefined symbol 'IID_IPersistFile'.
(218): E2451 Undefined symbol 'STGM_READ'.
(231): E2451 Undefined symbol 'SLGP_SHORTPATH'.
(240): E2268 Call to undefined function 'StringCbCopy'.
(248): E2268 Call to undefined function 'HandleErr'.
--
José
Back to top
Hans Galema
Guest





PostPosted: Sun Apr 23, 2006 8:03 am    Post subject: Re: Resolving a shortcut Reply with quote

José wrote:

Quote:
It's pretty complicated. I am surprised that there is no such thing as
a simple function: String ResolveShortCut (String lnkfile);

Then why not write your own ?

If you open a .lnk file in notepad you can see that the requested
path is behind 'Data '.

Knowing that, you can extract it.

Hans.
Back to top
José
Guest





PostPosted: Sun Apr 23, 2006 1:03 pm    Post subject: Re: Resolving a shortcut Reply with quote

On Sun, 23 Apr 2006 09:19:31 +0200, Hans Galema <notused (AT) notused (DOT) nl>
wrote in borland.public.cppbuilder.nativeapi:

Quote:
It's pretty complicated. I am surprised that there is no such thing as
a simple function: String ResolveShortCut (String lnkfile);

Then why not write your own ?

If you open a .lnk file in notepad you can see that the requested
path is behind 'Data '.

Sure, I have already programmed lots of functions without knowing that
they already existed.
--
José
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon Apr 24, 2006 7:03 pm    Post subject: Re: Resolving a shortcut Reply with quote

"José" <jose (AT) 127 (DOT) 0.0.1> wrote in message
news:rtjk42t6426h38shott0522k1on8evq50r (AT) 4ax (DOT) com...

Quote:
It's pretty complicated.

Welcome to Shell programming. Most things in the Windows Shell is exposed
as COM interfaces.

Quote:
I am surprised that there is no such thing as a simple function: String
ResolveShortCut (String lnkfile);


The article I pointed you to has the code for such a function.

Quote:
Besides, I may be a dunce, but the function ResolveIt on
the website doesn't compile:

Works fine for me. You probably did not include shlobj.h into your code.

Note that for shlobj.h, if you are using BCB 5 or higher, you need to add
NO_WIN32_LEAN_AND_MEAN to the Conditionals list in the Project Options.

Note also that StringCbCopy() is declared in strsafe.h, which is not shipped
with BCB at all. So you will have to download the latest Borland Platform
SDK from http://bccsdk.sourceforge.net in order to use it. Otherwise, use
strncpy() instead


Gambit
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.