[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

MFC & DLL

Posted on 2000-01-10
3
Medium Priority
?
334 Views
Last Modified: 2013-11-25
How do I export data from an MFC application to a DLL???
0
Comment
Question by:sischuja
3 Comments
 
LVL 3

Expert Comment

by:Shay050799
ID: 2339194
as far as i know, u need a callback function inside ur DLL
0
 
LVL 4

Expert Comment

by:inpras
ID: 2340515
What U mean export data?
0
 
LVL 1

Accepted Solution

by:
hrumayor earned 20 total points
ID: 2341784
There are three types of dll that MFC implemented well realy it is only one but they added code to make your life easy (rigth), we have the regular and extension DLL's, and the normal dll with no MFC.

regular dll's have the ability to load resources very easy with the command macro AFX_MANAGE_STATE(AfxGetStaticModuleState())
you load the resources of the dll so you can use this command inside a function call to a dialog and show the correct dialog form the resources.

The extension dll's are a try of microsoft in making a dll like if it was of the apication the resources of the dll are merged with the ones on the aplication so if you have repeated resoureces id in the DLL and exe you will have trouble but the advantage it that they are very easy to use you only add the macro AFX_EXT_CLASS on the begining of our clases and they are exported over the boundaries of the DLL so you can iclude the header of your dll's classes on the exe and you can start using it. Well before add the library so it can be linked with the dll.

You can also get the addres of a function in a dll with GetProcAddres previosly loading it with LoadLibrary you must export funcions on the dll in the def file or use the microsoft specific commands __declspec(dllexport)

Well to answer the question you have to get an addres of a function in the dll and with this funcion you can implement code that returns you the addres of a structure you can use this pointer ans write data to it. because they are on the same addres space. be aware of problems like making a new on the dll and making the delete in the exe this is not safe do a the delete and new on the same side it was made this has to do with the way the new and delete comands are impemented.

You can also consider the use of COM or a ligth version of com that you could implement.
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question