Export whatever functions you want to call. Call dialogs the same way you would in an exe.
CMyDialog dlg;
dlg.DoModal();
Printable View
Export whatever functions you want to call. Call dialogs the same way you would in an exe.
CMyDialog dlg;
dlg.DoModal();
Would they be static functions?
I guess my question here is:
Back when my app was just an exe, the winmain function was essentially the InitInstance() and the app would run when you debugged or well... ran it. From my understanding, when the CwinApp object is declared in global space, it calls InitInstance() to begin generating the dialogs. From my understanding, myDialogInstance.DoModal() is called in InitInstance(). Therefore, would I only have to export the CwinApp class? When the DLL is utilized in my text bench, do I just create an instance of:
CmyApp myapp?
You're way too hung up on the CWinApp class. Ordinarily you won't have much in the way of dealing with it. You can create and display dialogs in any function you choose to. You never create an instance of your app yourself. The framework does that for you.
All you should need to export is the functions you need to call.
OK I will try this. Thanks for your help.
I am hung up on it because I don't really understand what it does haha.
How do I edit my resources (the appearance of the windows) If Im using a MFC DLL template? Also when compiling a DLL, can I have multiple header files linked to it or do I have to compile all my classes and functions into 1 header? Sorry for my noobish questions...
The same way like you do that with MFC App. Resource can be embedded into any binary, exe or dll, so its editing is supported in both project types.
Sure you can. DLL is just another type of executable binary file. So there's no limitations of the kind.Quote:
Also when compiling a DLL, can I have multiple header files linked to it or do I have to compile all my classes and functions into 1 header? Sorry for my noobish questions...
Hi All,
Am I able to compile a MFC DLL and utilize it in a normal console application?
When I try to execute the console app, I don't have the exact error, but it tells me I must be compiling a MFC C++ application
Thanks for the help
Sure you can. DLL is a binary module able to be loaded into any Windows process.Quote:
Am I able to compile a MFC DLL and utilize it in a normal console application?
I have to admit I do not understand what exactly you do, execute or compile.Quote:
When I try to execute the console app, I don't have the exact error, but it tells me I must be compiling a MFC C++ application
Hi guys,
I'm giving this one last shot. I decided not to compile a DLL and simply place all source files and header files into the project directory. I got rid of anything pertaining to CwinApp and simply wrote a main method:
#include "stdafx.h"
#include "GCE_GUIDlg.h"
int main (void){
RT_Object *rto = NULL;
CGCE_GUIDlg myGUI;
myGUI.DoModal();
RT_ImportCopyObject(myGUI.rto, &rto);
return 0;
}
This is supposed to represent the C application performing a function call to attain the RT_Object
Also, being a complete noob, how do you write code neatly in a forum post?
It is compiling, however, i get this error:
First-chance exception at 0x789394ea (mfc100ud.dll) in GCE_GUI.exe: 0xC0000005: Access violation reading location 0x00000000.
Is this a lost cause? I am trying to learn the winAPI and start from scratch using this http://www.songho.ca/opengl/gl_mvc.html . I do have a deadline coming up though, and I am having trouble understanding this MVC framework. The reason for doing this is that I can code consistently with what the developers of the C Application have already done, thus guaranteeing that my app can be called from their app.
RT_ImportCopyObject(myGUI.rto, &rto);
Are you sure it wants a pointer to a pointer there?
Thanks for the reply
But yes, that is what the API dictates. I've tried adding break points when the main function starts, but the error occurs before anything even happens
It continues running but essentially will not progress past
// Perform specific initializations
if (!pThread->InitInstance())
{
within winmain.cpp
Actually now that I trhink about it, that is happening because I've completrely gotten rid of my CWinApp Classes, is there anyway I can just use my own main as opposed to the winmain used when creating a MFC application?