Mail Archives: cygwin/1998/05/11/23:49:24
Hi Michael,
Michael Lemke wrote:
> ... I also
> could not find which library exports the IShell stuff.
No documented library, it's a COM object, the binding is dynamic through
the ID IID_IShellLink.
> Is this the only way to make a shortcut? Looks extremely cumbersome to
> me.
Looks rather straight-forward to me ;-). One could ask, why this
function was not included in some OS DLL. But then at least they give
this code, and it's even in C, instead of the C++, which would be more
common for COM code.
> Anyway, here goes:
>
> #include <windows.h>
> // CreateLink - uses the shell's IShellLink and IPersistFile interfaces
> // to create and store a shortcut to the specified object.
> ....
> And that is what I get:
>
> BASH.EXE-2.01$ gcc shortc.c
> shortc.c: In function `CreateLink':
> shortc.c:16: `IShellLink' undeclared (first use this function)
> ...
> shortc.c:19: `CLSID_ShellLink' undeclared (first use this function)
> ...
> shortc.c:22: `IPersistFile' undeclared (first use this function)
Seem pretty clear to me. The sample code omits the headers for the COM
interfaces that it uses. The VC++ compiler probably has them included in
#include<windows.h>. According to my code you need #include<shlobj.h> to
get the definitions. This header was not included with cygwin32.b18 and
probably is not with b19 either. It certainly is in the PlatformSDK, so
you may want to try that version. You'll probably need some other
headers, too, that are sub-included from <shlobj.h>.
Note that in addition to the code given in the sample code you will need
to call CoInitialize() and CoUninitialize() to register your process
with COM. Look at the docs for these.
so long, benny
======================================
Benjamin Riefenstahl (benny AT crocodial DOT de)
Crocodial Communications EntwicklungsGmbH
Ruhrstraße 61, D-22761 Hamburg, Germany
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -