Click here to Skip to main content
15,894,405 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionIs there a linkable chat control? Pin
includeh1023-Mar-11 3:48
includeh1023-Mar-11 3:48 
AnswerRe: Is there a linkable chat control? Pin
Hans Dietrich23-Mar-11 5:19
mentorHans Dietrich23-Mar-11 5:19 
QuestionUse Modeless Dialog inside MFC DLL Pin
Andraw Tang22-Mar-11 11:52
Andraw Tang22-Mar-11 11:52 
AnswerRe: Use Modeless Dialog inside MFC DLL Pin
Ozer Karaagac22-Mar-11 14:14
professionalOzer Karaagac22-Mar-11 14:14 
GeneralRe: Use Modeless Dialog inside MFC DLL Pin
Andraw Tang23-Mar-11 2:40
Andraw Tang23-Mar-11 2:40 
AnswerRe: Use Modeless Dialog inside MFC DLL Pin
Hans Dietrich22-Mar-11 14:16
mentorHans Dietrich22-Mar-11 14:16 
GeneralRe: Use Modeless Dialog inside MFC DLL Pin
Andraw Tang23-Mar-11 2:41
Andraw Tang23-Mar-11 2:41 
AnswerRe: Use Modeless Dialog inside MFC DLL Pin
Nitheesh George22-Mar-11 23:04
Nitheesh George22-Mar-11 23:04 
Hi,

From your posting, I think that you wanted to a dialog box which is added a resource in your MFC dll. If I am right, It is a matter of simple. Please see the sample below.

extern "C" __declspec(dllexport) showMyDialog(CWnd *parent)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
CDialog *myDialog = new CDialog(IDD_DIALOG1, parent);
myDialog->ShowWindow(SW_NORMAL);
}

Make sure that you release the allocated memory in WM_NCDESTROY message handler code.

Then about the code. There is a problem when we want to show a dialog from an MFC DLL. The MFC will using main application resource handle to find the specified resource. If you not specify the AFX_MANAGE_STATE(AfxGetStaticModuleState( )); at the begginig of the exported function, the MFC framework will try to find the resource in main application's resource. If the specified resource not found, then the showWindow fails and if found, MFC will try to load that resource may causing an unexpected behaviour. For more infomation see the MSDN documentation of AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

Hope this helps

Thanks

Nitheesh George

Nitheesh George

http://www.simpletools.co.in
GeneralRe: Use Modeless Dialog inside MFC DLL Pin
Andraw Tang23-Mar-11 2:42
Andraw Tang23-Mar-11 2:42 
Questionconvert an image (black & white) to a file (zero & one) in the VC++ Pin
Shatha8822-Mar-11 9:08
Shatha8822-Mar-11 9:08 
AnswerRe: convert an image (black & white) to a file (zero & one) in the VC++ Pin
Niklas L22-Mar-11 20:43
Niklas L22-Mar-11 20:43 
GeneralRe: convert an image (black & white) to a file (zero & one) in the VC++ Pin
Shatha8823-Mar-11 9:02
Shatha8823-Mar-11 9:02 
AnswerRe: convert an image (black & white) to a file (zero & one) in the VC++ Pin
Cedric Moonen22-Mar-11 21:26
Cedric Moonen22-Mar-11 21:26 
QuestionHow to use structure constructor ? Pin
_Flaviu22-Mar-11 6:58
_Flaviu22-Mar-11 6:58 
AnswerRe: How to use structure constructor ? Pin
Ozer Karaagac22-Mar-11 7:57
professionalOzer Karaagac22-Mar-11 7:57 
GeneralRe: How to use structure constructor ? Pin
_Flaviu22-Mar-11 8:39
_Flaviu22-Mar-11 8:39 
GeneralRe: How to use structure constructor ? Pin
Stefan_Lang23-Mar-11 0:06
Stefan_Lang23-Mar-11 0:06 
QuestionwaveOutOpen Working Properly but Voice is Low Pin
AmbiguousName22-Mar-11 2:36
AmbiguousName22-Mar-11 2:36 
AnswerRe: waveOutOpen Working Properly but Voice is Low Pin
rp_suman22-Mar-11 23:11
rp_suman22-Mar-11 23:11 
QuestionCLSID for invisible Pin
sarfaraznawaz22-Mar-11 1:24
sarfaraznawaz22-Mar-11 1:24 
AnswerRe: CLSID for invisible Pin
Richard MacCutchan22-Mar-11 5:15
mveRichard MacCutchan22-Mar-11 5:15 
QuestionOpenPrinter() API Pin
msr_codeproject21-Mar-11 22:41
msr_codeproject21-Mar-11 22:41 
AnswerRe: OpenPrinter() API Pin
Richard MacCutchan21-Mar-11 23:57
mveRichard MacCutchan21-Mar-11 23:57 
QuestionMFC: How to set the focus to the previously focused window? Pin
Erik21-Mar-11 19:48
Erik21-Mar-11 19:48 
AnswerRe: MFC: How to set the focus to the previously focused window? Pin
tagopi21-Mar-11 22:16
tagopi21-Mar-11 22:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.