getprocaddress didn't load coinitialize
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: getprocaddress didn't load coinitialize

Hybrid View

  1. #1
    Join Date
    Nov 2012
    Posts
    4

    getprocaddress didn't load coinitialize

    Hello
    I am working to load CoInitialize using getprocaddress, but I don't know why this function fail and cash program! It didn't happen with other functions in other libraries like kernel32.dll. Here is my test :

    Code:
    typedef HRESULT (*pf)(LPVOID);
    	 
    pf rf = (pf)GetProcAddress(LoadLibrary(ole32.dll), "CoInitialize"); 
    CoInitialize(NULL); // This line crashes the program!!
    Do you know why and how to properly load it ?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,011

    Re: getprocaddress didn't load coinitialize

    If you directly call CoInitialize then why do you need to LoadLibrary/GetProcAddress?
    Besides, you have to check the return values of every API call before you use it in the next code stuff
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center