CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2003
    Posts
    375

    How to locallize a plug-in DLL file?

    I have experiences to localize a few MFC executable files, first create a resource dll file then add following code in InitInstance():

    Code:
    BOOL CMyApp::InitInstance()
    {
       //Default Application Wizard code.
       HINSTANCE hRes = NULL;
       hRes= LoadLibrary("ResourceD.dll");
       if(hRes)
          AfxSetResourceHandle(hRes);
       //Rest of wizard code
       return CWinApp::InitInstance();
    }
    Now I need to localize a dll file which is an IE web browser toolbar, who could tell me how localize the dll file? Thank you!

  2. #2
    Join Date
    Jan 2003
    Posts
    375

    Re: How to locallize a plug-in DLL file?

    I can create a resource dll for the plug-in dll, but I don't know how to import it into the plug-in dll.
    Last edited by forester; September 12th, 2013 at 08:32 AM.

  3. #3
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: How to locallize a plug-in DLL file?

    Does the plug-in API not provide some sort of 'init' function?
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  4. #4
    Join Date
    Jan 2003
    Posts
    375

    Re: How to locallize a plug-in DLL file?

    Thank you for your reply, D_Drmmr.

    There is no initializing function, but there is a OnCreate() function. Do you mean I can place AfxSetResourceHandle(hRes) in the Init function if there is one?

    hRes is the handle for the resource dll.

    Code:
    BOOL CMyClass::OnCreate()
    {
       ...
       HINSTANCE hRes = NULL;
       hRes= LoadLibrary("ResourceD.dll");  
       if(hRes)
          AfxSetResourceHandle(hRes);
       else
          return false;
       
        ...
    }

  5. #5
    Join Date
    Sep 2013
    Posts
    1

    Re: How to locallize a plug-in DLL file?

    i saw this issue in http://irprogramming.ir and this is my question , if anyone can help

  6. #6
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: How to locallize a plug-in DLL file?

    Quote Originally Posted by forester View Post
    There is no initializing function, but there is a OnCreate() function. Do you mean I can place AfxSetResourceHandle(hRes) in the Init function if there is one?
    That depends on when the OnCreate function is called. The point is to find some place for initialization and cleanup in the API that you need to expose.
    Quote Originally Posted by forester View Post
    Code:
    BOOL CMyClass::OnCreate()
    {
       ...
       HINSTANCE hRes = NULL;
       hRes= LoadLibrary("ResourceD.dll");  
       if(hRes)
          AfxSetResourceHandle(hRes);
       else
          return false;
       
        ...
    }
    What is CMyClass?
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  7. #7
    Join Date
    Jan 2003
    Posts
    375

    Re: How to locallize a plug-in DLL file?

    I write the plug-in dll following the tutorial at http://www.codeproject.com/Articles/1323/Internet-Explorer-Toolbar-Deskband-Tutorial,

    The CMyClass is similar to the CMFToolbar in the tutorial.

    In the tutorial article, there is a LRESULT CMFToolbar::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) {}
    but no other initialization function.

    Thank you for your help!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured