Building a MFC App on top of a working Console Application
-
Hi, I am currently building a C++ application and I want to add some gui stuff to it. Basically, it should only show the status of the basecode (I'm currently doing everything as console output), so there won't be any/much interaction with the gui and the base application. Now I want to abstract it, that I won't have to put any MFC/Gui code into the base code. So, I thought about some sort of event callback functions. Somewhere in the MFC init phase:
myapp = New MyApplication; myapp->SetEvent1Callback(&MyMfcApp::Event1Callback); myapp->SetEvent2Callback(&MyMfcApp::Event2Callback); void MyMfcApp::Event1CallBack(long para) { BlinkBlink(para) }
Somewhere in my Code:if(event1callback) (*eventcallback1)(para1, para2, ...);
This way, I will still be able to develop the C++ basecode without mixing it with any MFC Code. You may ask why? The reason is that I want to have my C++ code gui free and change the *bling-bling* gui system later. Is it a good idea? I'm open for every comment. Greetings -
Hi, I am currently building a C++ application and I want to add some gui stuff to it. Basically, it should only show the status of the basecode (I'm currently doing everything as console output), so there won't be any/much interaction with the gui and the base application. Now I want to abstract it, that I won't have to put any MFC/Gui code into the base code. So, I thought about some sort of event callback functions. Somewhere in the MFC init phase:
myapp = New MyApplication; myapp->SetEvent1Callback(&MyMfcApp::Event1Callback); myapp->SetEvent2Callback(&MyMfcApp::Event2Callback); void MyMfcApp::Event1CallBack(long para) { BlinkBlink(para) }
Somewhere in my Code:if(event1callback) (*eventcallback1)(para1, para2, ...);
This way, I will still be able to develop the C++ basecode without mixing it with any MFC Code. You may ask why? The reason is that I want to have my C++ code gui free and change the *bling-bling* gui system later. Is it a good idea? I'm open for every comment. GreetingsDo you need any of the MFC classes? Why not just develop your console app without MFC? Mark
-
Hi, I am currently building a C++ application and I want to add some gui stuff to it. Basically, it should only show the status of the basecode (I'm currently doing everything as console output), so there won't be any/much interaction with the gui and the base application. Now I want to abstract it, that I won't have to put any MFC/Gui code into the base code. So, I thought about some sort of event callback functions. Somewhere in the MFC init phase:
myapp = New MyApplication; myapp->SetEvent1Callback(&MyMfcApp::Event1Callback); myapp->SetEvent2Callback(&MyMfcApp::Event2Callback); void MyMfcApp::Event1CallBack(long para) { BlinkBlink(para) }
Somewhere in my Code:if(event1callback) (*eventcallback1)(para1, para2, ...);
This way, I will still be able to develop the C++ basecode without mixing it with any MFC Code. You may ask why? The reason is that I want to have my C++ code gui free and change the *bling-bling* gui system later. Is it a good idea? I'm open for every comment. Greetings -
Do you need any of the MFC classes? Why not just develop your console app without MFC? Mark
No, I don't need any MFC classes internal. But I want to have visual output of the data. Is some sort of call monitor (with data transfer). The base code is already handling everything, but I want to see, when a new connections comes in (using some sort of leds), when a connection cancels and some sort of history monitor.
-
Hi, I think it's an interesting idea. Sort of Document/View architecture on steroids. Best of Luck Tom PS. what sort of IPC are you considering?
TClarke wrote:
I think it's an interesting idea. Sort of Document/View architecture on steroids.
:laugh:
TClarke wrote:
PS. what sort of IPC are you considering?
Well, I don't want to use some sort of IPC, only simple function calls. As I posted in the other post, it's some sort of calling montior, so I thought something like this: When a new connection comes in: (in my base code)
if(newconnection) (ConnectEvent)(ConnectionID, CallerNumber, ...)
And the MFC should then enable an (software) led or something.