www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - Resources in own libraries

reply "Heinz-Peter Nüttgens" <hnuettgens t-online.de> writes:
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
Dec 04 2003
parent reply Jan Knepper <jan smartsoft.us> writes:
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
Dec 05 2003
parent reply "Heinz-Peter Nüttgens" <hnuettgens t-online.de> writes:
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

Dec 06 2003
parent Jan Knepper <jan smartsoft.us> writes:
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
Dec 06 2003