Click here to Skip to main content
15,896,118 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: try/catch Variable Scope Question Pin
palbano4-Aug-04 7:49
palbano4-Aug-04 7:49 
GeneralRe: try/catch Variable Scope Question Pin
Steve Thresher4-Aug-04 10:07
Steve Thresher4-Aug-04 10:07 
GeneralRe: try/catch Variable Scope Question Pin
palbano4-Aug-04 7:43
palbano4-Aug-04 7:43 
GeneralRe: try/catch Variable Scope Question Pin
Tim Smith4-Aug-04 15:26
Tim Smith4-Aug-04 15:26 
GeneralRe: try/catch Variable Scope Question Pin
Ryan Binns4-Aug-04 18:46
Ryan Binns4-Aug-04 18:46 
QuestionNewbie: Can I do this? Pin
cgriffin4-Aug-04 5:52
cgriffin4-Aug-04 5:52 
AnswerRe: Newbie: Can I do this? Pin
palbano4-Aug-04 7:16
palbano4-Aug-04 7:16 
AnswerRe: Newbie: Can I do this? Pin
digwizfox4-Aug-04 7:31
digwizfox4-Aug-04 7:31 
Sounds reasonable. You can program a DLL to do many things for you as long as you define a good interface. DLLs can contain classes and/or global functions that can be exported so that an application project can link to it. I like to think of DLLs kind of like how I think of classes. You figure out what you want it to do; what kind of logic/common code you want in it and design a good user interface so that other projects can link to the functions and/or classes.

We have a main app project that links to MFC extension DLLs. Use the wizard to create your ext DLLs and it is very simple. In some cases our MFC extension DLLs export class definitions (such as common dialogues). Then the main app can use #include "TheDialogueHeader.h" and then instantiate the dialogue like any other MFC class and implement a modal or modeless dialogue.

We also have DLLs that export a thread function that the application can link to and call by passing the function pointer to AfxBeginThread. Then you have a DLL with a main function that is a thread that will execute along with all of the threads in the Main App project. So your Initialize() func could be a thread or just a function that can be called and will return when finished. If it is a thread, then use the terminate function to implement the signaling logic that will cause the thread(s) in the DLL to terminate for a clean exit.

There are lots of ways to do it but what you are describing seems like a reasonable thing to do. The possibilities are endless and there are many different ways of organizing the code within your DLL. Just like a class, you can have global functions in the DLL or classes that are not exported (private to the rest of the world) that are called by the exported functions/classes (public to the world); and so on and so on.

Have fun!
Shawn
GeneralRe: Newbie: Can I do this? Pin
cgriffin4-Aug-04 7:45
cgriffin4-Aug-04 7:45 
GeneralRe: Newbie: Can I do this? Pin
digwizfox4-Aug-04 8:46
digwizfox4-Aug-04 8:46 
GeneralRe: Newbie: Can I do this? Pin
cgriffin4-Aug-04 10:10
cgriffin4-Aug-04 10:10 
GeneralRe: Newbie: Can I do this? Pin
digwizfox4-Aug-04 10:24
digwizfox4-Aug-04 10:24 
Generaliphelper Pin
Zizilamoroso4-Aug-04 4:24
Zizilamoroso4-Aug-04 4:24 
GeneralRe: iphelper Pin
David Crow4-Aug-04 4:30
David Crow4-Aug-04 4:30 
GeneralIStorage like functionality in memory Pin
pankajdaga4-Aug-04 4:14
pankajdaga4-Aug-04 4:14 
GeneralRe: IStorage like functionality in memory Pin
Chris Losinger4-Aug-04 5:28
professionalChris Losinger4-Aug-04 5:28 
GeneralRe: IStorage like functionality in memory Pin
pankajdaga4-Aug-04 6:49
pankajdaga4-Aug-04 6:49 
GeneralMenus in VC 7 not working after resource cleanup Pin
PrashantJ4-Aug-04 3:53
PrashantJ4-Aug-04 3:53 
GeneralRe: Menus in VC 7 not working after resource cleanup Pin
Tim Smith4-Aug-04 3:59
Tim Smith4-Aug-04 3:59 
GeneralRe: Menus in VC 7 not working after resource cleanup Pin
PrashantJ4-Aug-04 4:04
PrashantJ4-Aug-04 4:04 
GeneralUsing Created() CListBox Pin
gokings4-Aug-04 3:52
gokings4-Aug-04 3:52 
GeneralRe: Using Created() CListBox Pin
David Crow4-Aug-04 4:25
David Crow4-Aug-04 4:25 
GeneralRe: Using Created() CListBox Pin
gokings4-Aug-04 5:24
gokings4-Aug-04 5:24 
GeneralRe: Using Created() CListBox Pin
David Crow4-Aug-04 5:58
David Crow4-Aug-04 5:58 
GeneralRe: Using Created() CListBox Pin
gokings5-Aug-04 22:08
gokings5-Aug-04 22:08 

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.