From: benny AT crocodial DOT de (Benjamin Riefenstahl) Subject: Re: How to create shortcut? 11 May 1998 23:49:24 -0700 Message-ID: <35572422.10DF2FDB.cygnus.gnu-win32@crocodial.de> References: <35559FEB DOT 9542CF0B AT mail DOT bamberg DOT baynet DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit To: ai26 AT a400 DOT sternwarte DOT uni-erlangen DOT de, gnu-win32 AT cygnus DOT com 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 > // 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. According to my code you need #include 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 . 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".