brent's hut

LoadLibrary in IE activex control

I write an Internet Explorer ActiveX control and need to load a dll in it.
Says my control's ocx file is "C:\\test.ocx", the dll file is "C:\\test.dll".

So i write a line of code like this:
HANDLE hDll = ::LoadLibrary("C:\\test.dll");

Since i have told it to load from the very path, and the dll is in same dir with my ocx, it should work perfectly.
but it always return: ERROR_MOD_NOT_FOUND (The specified module could not be found.)

Damned it, i try all kinds of parameters pass into LoadLibrary, i even sign the dll. It kept returning error.

I google a lot, no one tells why. Read MSDN carefully, nothing was found.

After a lot frustrating failure. I just try LoadLibraryEx like this:
HANDLE hDll = ::LoadLibraryEx("C:\\test.dll",NULL,LOAD_WITH_ALTERED_SEARCH_PATH);

It works.

Thank you Microsoft.

posted on 2008-08-07 17:14 brent 阅读(1031) 评论(2)  编辑 收藏 引用

评论

# re: LoadLibrary in IE activex control 2009-11-18 14:52 Jack White

Thank you too! I solved my problem with the same way you pointing out.  回复  更多评论   

# re: LoadLibrary in IE activex control 2011-04-27 11:43 xxoo

谢了,我也被 这个问题折磨了好久  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理