Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to use MFC classes in a no-MFC dll? 1

Status
Not open for further replies.

AliFessi

Programmer
Jul 3, 2001
12
0
0
DE
Hi there,

is it possible to use MFC classes like CFileDialog or CObject in a no-MFC dll?

I suppose no but I just want to to leave no doubt!
When I include the file afxwin.h in the dll I receice several link errors.

Regards.
 
Using the said classes is using MFC. These classes are part of the MFC##.DLL runtime. So, using them means you're using the DLL.

You can however mimic what the MFC classes are doing by writing your own wrapper classes.

B
 
Without linking your DLL to the MFC runtimes, no you won't be able to use any of the MFC classes (such as CObject, etc). The MFC libraries are an annoying overhead, both in terms of performance and size (especially when you have to ship them with a relatively small application) but I think the advantage of having such an extensive framework of pre-written Windows classes far outweighs this.

(Although I'm sure Win32 purists will disagree)
 
you can export C type functions rfom a dll by declaring them with #extern "C", instead of classes use handles as the first parameter in the functions. There you'll put the pointer to an MFC object. THe created DLLs shpuld be created as using MFC as statically linked library. Ion Filipski
1c.bmp


filipski@excite.com
 
I am writing an active x control to use another activex control at runtime . I have loaded it using hte typelib and two _D classes were created. When I try to use the instances of the classes XXX.CreateDispatch(_T("The control name")); if failes because this returns 0 any help will be appreciated.
regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top