Re: ERROR_RESOURCE_TYPE_NOT_FOUND error comes



kkagarwal2002@xxxxxxxxx> wrote in message news:27c62fd1-015c-466b-be44-c1ff11ead814@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 14 Feb, 16:28, "David Ching" <d...@xxxxxxxxxxxxxxxxxxxxxx> wrote:
<kkagarwal2...@xxxxxxxxx> wrote in message

news:1e81f75d-c129-4b3f-890c-bb537bda24e4@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx





> Hello Everybody,

> I am unable to load the bitmap image in CListCtrl control. I made
> application as follows:

> 1. Made DLL which contains resources like dialog, bitmap etc. by
> having the multiple .rc files in a project.
> 2. Made a static lib project which contains classes for resources
> which are in DLL. This lib is also having a dependency of DLL.
> 3. Made a 2 Exes which load that lib. It has a dialog which contains
> CListCtrl. This control is populated by lib classes.

> I am using VS2003. I am getting surprised result when i run two exes.
> one exe shows bitmap in CListCtrl but other does not. I am loading the
> bitmap in one of the class of static lib using LoadBitmap but it
> returns 0 and when i tried to get error code, it gives 1813.

> Can anybody help me on this issue?

> Thanks in advance.

> Kamal

Error 1813 is, "The specified resource type cannot be found in the image
file. "

It sounds like the wrong resource handle is being used. This is controlled
somewhat by MFC at startup, which looks for a DLL named with the current
locale ID, and if not found, is defaulted to the app .exe itself. If you
want to control it yourself, call AfxSetResourceHandle() at a convenient
place, normally CWinApp::InitInstance() (actually, this method in your
derived class).

-- David- Hide quoted text -

- Show quoted text -

Hello David,

Thanks for prompt reply. Actually My exe also has resources and my DLL
also has resources so when i will do AfxSetResourceHandle from Exe to
DLL then my exe resource will not be used. I want to escape from that
situation.

Do you have any other alternative approach?


Is your DLL a resource-only DLL? If so, you have to use AfxSetResourceHandle. If you also want to use the resources in your exe, you have to add the DLL to the MFC resource chain. To solve this, I added a function to the dll that I explicitly call from my exe so MFC loads it and adds it to the chain.


.



Relevant Pages

  • Re: #pragma lib buggers everything up
    ... A lot of the resources are relevant to the static ... a client exe, and I experienced these too, i.e. the exe can't use any ... Have a resource-only DLL, you might say, - yes, I did consider this but the ... > and often on a particular version of the compiler and particular compiler ...
    (microsoft.public.vc.language)
  • Re: Debugging dll newb question
    ... Close all of your VB IDE copies, Open the standard EXE project file. ... but sets the file name for the DLL to itself. ... have to make a UserControl as an OCX to use it in an EXE. ... EXE project, just go to Project-->Add User Control, and start making your ...
    (microsoft.public.vb.general.discussion)
  • Re: ERROR_RESOURCE_TYPE_NOT_FOUND error comes
    ... I am unable to load the bitmap image in CListCtrl control. ... Made DLL which contains resources like dialog, ... Made a static lib project which contains classes for resources ...
    (microsoft.public.vc.mfc)
  • Re: Localization of my MFC application
    ... We create a set of resource files for each separate program (.EXE, .DLL, ... My resources are not so large that it makes a big ... > We have an application which has an exe and uses two MFC extension DLLs ...
    (microsoft.public.vc.mfc)
  • Re: Simple Input In a MFC application
    ... other MFC programmers have followed parallel lines to augment the MFC in a ... either distributing an extra dll or having to include resources in calling ... which is why I'd use a DLL ... Place an edit control on the dialog ...
    (microsoft.public.vc.mfc)