Sign in to follow this  
Decept

Using dialogs in lib files (VC6)

Recommended Posts

Decept    144
I have previously asked this question on a forum on another website, but haven't been able to solve this problem. Hope you guys can help. I'm trying to create a dialog box from a lib file, but the DialogBox() constantly fails. I'm using VC++ 6 and the dialog box is a custom one that I have created. I have done this many times before without a problem, but I have never tried to do it from a lib file before. The first parameter to DialogBox() is an instance handle, I send in the instance from the app that is using the lib. I've tested the lib with two projects. One is my game, which has 1 resource of its own, an icon. And then I created a test project just to see why the lib fails. The test project is a simple win32 application, with nothing in it, except a call to the lib. When I check the GetLastError() function and I get these results: from the game: "the specified resource type cannot be found in the image file" from the test app: "the specified image file did not contain a resource section" Any ideas?

Share this post


Link to post
Share on other sites
Verg    450
In the second case, it sounds like you're trying to use both an outside resource script and resource.h in a static library... won't work. The resources aren't included in the static library, so the defines in resource.h mean nothing to the library code. For instance "IDD_DIALOG1" would mean nothing to the .lib code, so how would it find the correct data to instantiate the Dialog?

If there were a way you could include both the resource script and resource.h in the library, it would work...

What about building a generic dialog box into the library, (with its own resource script) and pass parameters to some library function that would put the values in the controls that you need? Or something along those lines.

Share this post


Link to post
Share on other sites
Toraque    229
If I understand your problem correctly, it sounds like you're calling a dialog from a dll.

One way to do this that I've found to work is by calling SetResourceHandle on the dll before calling the dialog.

Another option is calling a function inside the dll, which then calls the dialog--that way, the dll handles it all by itself.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this