I currently use CreateProcess and can therefore obtain the PID directly but
have to do a bit of preprocessing on the lnk file to get the executable name
from the lnk.
I now need to be able to deal with folder shortcuts and can't quite figure
out a 'nice' generic solution to launch such lnk files.
Backtracking a little, I experimented with ShellExecuteEx, passing it the
actual lnk file ... it deals with all that I want but I can't figure out how
to get anything that will enable me to get the PID ... as it's a lnk file,
even the hProcess returned value is zero.
So is there a way to preprocess a lnk file so that I can pass it on to
CreateProcess or is there another solution ? (by the way, I need it to work
with Windows 98 so stuff like GetProcessID won't be an option.)
Thanks
Andrew
You can find a component and a demo here that I think does what you want:
http://subsimple.com/delphi.asp (ShellLinker).
Troels
"Andrew Jameson" <con...@softspotsoftware.com> wrote in message
news:422e...@newsgroups.borland.com...
As I said, CreateProcess does give me the PID whereas ShellExecute doesn't
and maybe there's a way to get it ?
I've actually solved my problem ... I preprocess all shortcuts to get the
target executable using IShellLink and if it's not an exe then I get the
associated executable from FindExecutable. Now the only shortcut that I
have problems with is a folder shortcut and I wouldn't get a PID for this
anyway ... so my workaround is to call ShellExecute if CreateProcess fails.
(I'm writing an application launch manager and need to monitor all launched
applications - providing restrictions to limit the number of launched
instances and to automatically close all launched applications when the
launch manager closes.)
By the way, your Delphi examples are excellent ! ... very impressed !
Andrew
"Troels Jakobsen" <do...@like.spam> wrote in message
news:422f8e22$1...@newsgroups.borland.com...
Troels
"Andrew Jameson" <con...@softspotsoftware.com> wrote in message
news:42300bbd$1...@newsgroups.borland.com...