How can I use this function to load winapi interfaces like ishelllink from dll , I already can load winapi functions properly without problems
Asked
Active
Viewed 165 times
-5
-
`ishelllink` is a COM interface have a look in the DLL listed in https://msdn.microsoft.com/en-us/library/windows/desktop/bb774950(v=vs.85).aspx But probably easier just to use COM normally. Also this: https://blogs.msdn.microsoft.com/oldnewthing/20040205-00/?p=40733 – Richard Critten Mar 11 '18 at 21:14
-
Difficult to know what you are asking here. Why can't you use these COM interfaces? – David Heffernan Mar 11 '18 at 21:20
-
3This sounds like an [XY Problem](http://xyproblem.info/). What problem are you _actually_ trying to resolve? – Jabberwocky Mar 12 '18 at 07:55
-
Are you trying to understand how `CoCreateInstance` works? Given that it (must) leverage `LoadLibrary` and `GetProcAddress`? – Chris Becke Mar 12 '18 at 10:43
-
2You cannot load an interface from a DLL. You can load a server DLL, and request that its class factory constructs an interface implementation on your behalf. So as written, the question really doesn't make much sense, and is probably the result of failure to fully understand COM. – IInspectable Mar 12 '18 at 12:17
1 Answers
2
IShellLink
is a COM interface. You don't use LoadLibrary()
to access COM objects, you need to use CoCreateInstance()
instead. There is a code example in the Using Shell Links documentation on MSDN.

Remy Lebeau
- 555,201
- 31
- 458
- 770
-
I know its a com interface and I already can use it but I only gave an example for the interfaces , I want to be able to get them dynamically during runtime – prog511 Mar 12 '18 at 04:11
-
3@prog511: If that is what you are trying to accomplish, you are going to have to re-invent the registry. And a substantial part of the COM infrastructure: [CoGetClassObject](https://msdn.microsoft.com/en-us/library/windows/desktop/ms684007.aspx). That sounds a lot like you haven't quite understood COM yet. What are you *really* trying to accomplish here? – IInspectable Mar 12 '18 at 12:15
-
1@prog511 "*I want to be able to get them dynamically during runtime*" - `CoCreateInstance()` **IS** how you get them dynamically at runtime – Remy Lebeau Mar 12 '18 at 16:09
-