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

    Unhappy error 1813_the resource type cannot be found in the image file

    I'm trying to create a dialog from within the dll. I have a main window which is created using the CreateWindow() function and it takes the instance (hinstance) of the dll. hinstance variable is global in my case. I am calling createdialog() function using WM_CREATE message of CreateWindow(). CreateDialog() is being called from within a thread.

    In my case, I am using the same global hinstance for the window and the CreateDialog() function. Can I use the same instance for creating a window and creating a dialog from within the window?

    Am I seeing error 1813 (the resource type cannot be found in the image file) becuase of this? or is it that dll is not able to find the resource correctly? I also have two .rc files which dll uses (one is version.rc and other one is for the dialog resources). Can I use two resource files for one dll?

    Can somebody please help me with my questions. Please find the createdialog() function I am using.

    Thanks in advance.


    P.S.

    CreateDialog (g_hinstance, MAKEINTRESOURCE (DLG_MAIN), 0, (DLGPROC)DialogProc);

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: error 1813_the resource type cannot be found in the image file

    Does your g_hinstance contain the DLL handle (where your dialog is supposed to be) or the exe handle (where your main window resource was placed)?
    Victor Nijegorodov

  3. #3
    Join Date
    Jan 2012
    Posts
    8

    Re: error 1813_the resource type cannot be found in the image file

    g_hinstance has the DLL handle.

    BOOL APIENTRY DllMain(
    HANDLE hModule,
    DWORD ul_reason_for_call,
    LPVOID lpReserved)
    {
    switch(ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
    g_hInstance = (HINSTANCE)hModule;
    break;

    case DLL_PROCESS_DETACH:
    break;
    }
    return(TRUE);
    }

    And, this is also being used the window I created.

    wndclass.hInstance = g_hInstance

    Can I do this? Can the dll handle be used for both the window and the dialog?

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: error 1813_the resource type cannot be found in the image file

    Quote Originally Posted by procky238 View Post
    Am I seeing error 1813 (the resource type cannot be found in the image file) becuase of this?
    Take the .DLL file and load it into Visual Studio as a resource (if you use Visual Studio). Do you see the dialog as one of the resources? If not, then the resources do not exist in your dialog.

    Regards,

    Paul McKenzie

  5. #5
    Join Date
    Jan 2012
    Posts
    8

    Re: error 1813_the resource type cannot be found in the image file

    thanks, Paul. I figured out the issue. the resource file was getting included in the compilation process.

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