P
Phoenix
Hi all,
I am currently developping in C++ (with Visual Studio 6) an outlook
add-in. I need to ask the user to choose something from a combobox. So
what I thought is to do a Dialog Box asking the user to select an item
in a combobox. I did the same thing I would do for a normal exe that
is: creating the ressource, the class linked to the ressource and then
in my code when pressing a certain button displaying the DialogBox in a
modal way :
CDialogLabels dlgLabels;
dlgLabels.DoModal();
Yes but it doesn't work ! GetLastError returns 1812
(ERROR_RESOURCE_DATA_NOT_FOUND : The specified image file did not
contain a resource section.). After a few researches I found out that
for a dll when doing that windows tries to load the ressource from the
exe (using the exe context) when it should load it from the DLL. Some
people proposed to add :
HINSTANCE hRes = NULL;
hPrevRes = AfxGetResourceHandle();
hRes = LoadLibrary("OutlookPhoenix.dll");
if(hRes)
AfxSetResourceHandle(hRes)
in the InitInstance of the dll
And then
AfxSetResourceHandle(hPrevRes);
in the ExitInstance.
This is setting the global resource handler to the dll instance
handler.
Right now the DialogBox is showing but ... Outlook crashes.
I tried a FreeLibrary in the ExitInstance, I tried not to get the hRes
by loading the library but using some
GetModuleHandle("OutlookPhoenix.dll") ... But still it's not working !
Outlook still crashes. I think it's because I'm setting globaly the
ResourceHandle for all the application and Outlook doesn't like that
(probably it tries also to load some resources and then crashes).
I tried to do the job using a modeless dialog box but can't manage to
display it (the Create fails, I can't get the full error description).
I don't have anymore ideas, could you help me ?
Thanks in advance,
Best Regards,
Maximilien
I am currently developping in C++ (with Visual Studio 6) an outlook
add-in. I need to ask the user to choose something from a combobox. So
what I thought is to do a Dialog Box asking the user to select an item
in a combobox. I did the same thing I would do for a normal exe that
is: creating the ressource, the class linked to the ressource and then
in my code when pressing a certain button displaying the DialogBox in a
modal way :
CDialogLabels dlgLabels;
dlgLabels.DoModal();
Yes but it doesn't work ! GetLastError returns 1812
(ERROR_RESOURCE_DATA_NOT_FOUND : The specified image file did not
contain a resource section.). After a few researches I found out that
for a dll when doing that windows tries to load the ressource from the
exe (using the exe context) when it should load it from the DLL. Some
people proposed to add :
HINSTANCE hRes = NULL;
hPrevRes = AfxGetResourceHandle();
hRes = LoadLibrary("OutlookPhoenix.dll");
if(hRes)
AfxSetResourceHandle(hRes)
in the InitInstance of the dll
And then
AfxSetResourceHandle(hPrevRes);
in the ExitInstance.
This is setting the global resource handler to the dll instance
handler.
Right now the DialogBox is showing but ... Outlook crashes.
I tried a FreeLibrary in the ExitInstance, I tried not to get the hRes
by loading the library but using some
GetModuleHandle("OutlookPhoenix.dll") ... But still it's not working !
Outlook still crashes. I think it's because I'm setting globaly the
ResourceHandle for all the application and Outlook doesn't like that
(probably it tries also to load some resources and then crashes).
I tried to do the job using a modeless dialog box but can't manage to
display it (the Create fails, I can't get the full error description).
I don't have anymore ideas, could you help me ?
Thanks in advance,
Best Regards,
Maximilien