Thread overview
Resources in own libraries
Dec 05, 2003
Jan Knepper
Dec 07, 2003
Jan Knepper
December 05, 2003
Hello,

perhaps anyone can help:

I try to implement a dialog box in an own library. There is a resource file linked with this lib but when I use "CreateDialog" it returns windows error 1812.

When I add the resource (I'm working with *.rc files) of the
dialog to the resource of the main application, everything works fine.

I wonder whether and how it's possible to use more than one resource file in an application?

Greetings

Heinz-Peter



December 05, 2003
Yes, you can add the resources to the .DLL, but you have to make sure that you can also load the resource from the .DLL and not from the .EXE.
Per default the functions load resources from the main instance and not from the .DLL instance.

So, make sure that the HINSTANCE parameter to CreateDialog is an instance to the .DLL and NOT to the .EXE using the .DLL.

HTH



Heinz-Peter Nüttgens wrote:
> Hello,
> 
> perhaps anyone can help:
> 
> I try to implement a dialog box in an own library. There is
> a resource file linked with this lib but when I use
> "CreateDialog" it returns windows error 1812.
> 
> When I add the resource (I'm working with *.rc files) of the
> dialog to the resource of the main application, everything works fine.
> 
> I wonder whether and how it's possible to use more than one
> resource file in an application?
> 
> Greetings
> 
> Heinz-Peter
> 
> 
> 


-- 
ManiaC++
Jan Knepper

December 06, 2003
Hello,

thanks a lot for your suggestion, but I'm not using a DLL.
Instead of this I use an old fashioned static library, which is
bound to the rest of the application by the linker. Therefore
there is only the instance of the WinMain of the application.
I just tried to use a local resource in this library, which failed.

Perhaps you know some kind of workaround or even a solution :-)

Greetings

Heinz-Peter

"Jan Knepper" <jan@smartsoft.us> schrieb im Newsbeitrag news:bqq5nn$1f8t$1@digitaldaemon.com...
> Yes, you can add the resources to the .DLL, but you have to make sure that you can also load the resource from the .DLL and not from the .EXE. Per default the functions load resources from the main instance and not from the .DLL instance.
>
> So, make sure that the HINSTANCE parameter to CreateDialog is an instance to the .DLL and NOT to the .EXE using the .DLL.
>
> HTH
>
>
>
> Heinz-Peter Nüttgens wrote:
> > Hello,
> >
> > perhaps anyone can help:
> >
> > I try to implement a dialog box in an own library. There is a resource file linked with this lib but when I use "CreateDialog" it returns windows error 1812.
> >
> > When I add the resource (I'm working with *.rc files) of the
> > dialog to the resource of the main application, everything works fine.
> >
> > I wonder whether and how it's possible to use more than one resource file in an application?
> >
> > Greetings
> >
> > Heinz-Peter
> >
> >
> >
>
>
> -- 
> ManiaC++
> Jan Knepper
>


December 07, 2003
OK, if you are using a static .LIB your resource can not be included in the .LIB, but will have to be compiled into the .EXE.
To to this just add a like
#include "<library-resources>.rc"
into the application .rc file.

HTH


Heinz-Peter Nüttgens wrote:
> Hello,
> 
> thanks a lot for your suggestion, but I'm not using a DLL.
> Instead of this I use an old fashioned static library, which is
> bound to the rest of the application by the linker. Therefore
> there is only the instance of the WinMain of the application.
> I just tried to use a local resource in this library, which failed.
> 
> Perhaps you know some kind of workaround or even a solution :-)
> 
> Greetings
> 
> Heinz-Peter
> 
> "Jan Knepper" <jan@smartsoft.us> schrieb im Newsbeitrag
> news:bqq5nn$1f8t$1@digitaldaemon.com...
> 
>>Yes, you can add the resources to the .DLL, but you have to make sure
>>that you can also load the resource from the .DLL and not from the .EXE.
>>Per default the functions load resources from the main instance and not
>>from the .DLL instance.
>>
>>So, make sure that the HINSTANCE parameter to CreateDialog is an
>>instance to the .DLL and NOT to the .EXE using the .DLL.
>>
>>HTH
>>
>>
>>
>>Heinz-Peter Nüttgens wrote:
>>
>>>Hello,
>>>
>>>perhaps anyone can help:
>>>
>>>I try to implement a dialog box in an own library. There is
>>>a resource file linked with this lib but when I use
>>>"CreateDialog" it returns windows error 1812.
>>>
>>>When I add the resource (I'm working with *.rc files) of the
>>>dialog to the resource of the main application, everything works fine.
>>>
>>>I wonder whether and how it's possible to use more than one
>>>resource file in an application?
>>>
>>>Greetings
>>>
>>>Heinz-Peter
>>>
>>>
>>>
>>
>>
>>-- 
>>ManiaC++
>>Jan Knepper
>>
> 
> 
> 


-- 
ManiaC++
Jan Knepper