Click to See Complete Forum and Search --> : Loading Dialog in a DLL


TaLF
December 20th, 2002, 09:09 PM
Hi,

I did a DLL and it's a shell extension for the context menu of Explorer. Everything works perfect, but I can't show my dialog resources (this dialog is compiled into the dll).

When I load a string resource like this:

CComModule _Module;
LoadString(_Module.GetModuleInstance(), IDS_STRING, szMsg, MAX_PATH));

... the string is loaded into szMsg.

But When I try to load my Dialog:

DialogBox(_Module.GetModuleInstance(), MAKEINTRESOURCE(IDD_DIALOG1), 0, WinProcTest);

and no error seems to apears (DialogBox doesn't return -1)

But the WM_INITDIALOG (of WinProcTest) is never called.

If you have any idea, please help me.
thanks in advance...

galathaea
December 21st, 2002, 12:16 AM
I see nothing wrong with what you have shown, so I wonder how the context of the two calls differ (do you do this all in one spot or are these in two different functions?). The reason I ask this is because DialogBox is a macro, and there are sometimes some weird things thay can happen (for instance, commas and nested calls). Also, it would be nice to know what DialogBox does return and what a call to GetLastError returns. Also, does your DialogProc ever get called (even for other messages)?

Maybe it might be easier to isolate the problem if you show a little more code surrounding the problem and give the diagnostic information listed above. One final suggestion I might give, though in no way related to your question, is to not use varaiable names that begin with an underscore in c++. Such names are reserved by the standard, and various implementations (such as in standard library headers) may have conflicts (though I could see no reason they would name something _Module). Anyways, excuse the aside. I'm just happy to see a post here in this new forum!

TaLF
December 21st, 2002, 07:15 AM
Thanks for you're reply...

Now, I don't really know what I did... but it seems to works.

And for the underscore of _Module, it's a variable created by the ATL COM AppWizard of vc++ :)

Caprice
December 30th, 2002, 08:25 AM
InitCommonControls() ?

Indian_Techie
January 2nd, 2003, 08:40 AM
are you using MFC? if so.. have you used AFX_MANAGE_STATE??

Eg:

AFX_MANAGE_STATE(AfxGetStaticModuleState());


john.