redirect i/o
|
Go4Expert Member
|
|
| 19Jun2006,09:33 | #1 |
|
my mfc app calls a dll (open source) that sends strings to standard out (cout). How to redirect that to my mfc app during runtime?.
|
|
Go4Expert Founder
|
![]() |
| 19Jun2006,10:11 | #2 |
|
There more than one option to do this.
1. They should provide an option of sending the output to some other window apart from console. 2. You should edit the necessary function to have the same functionality as its open source. 3. You write your own dll to to send the output to your program. |
|
Go4Expert Member
|
|
| 19Jun2006,11:50 | #3 |
|
it is a c++ dll (must keep it c++ dll). Not windows dll. its has a class member, int m_counter;
Code:
void CUpCalss::Func()
{
for (,,)
m_counter++;
i like this m_counter get updated in edit control of my mfc gui.
}
|
|
Go4Expert Founder
|
![]() |
| 19Jun2006,12:43 | #4 |
|
There are lots of ways you can do this.
1. You write the class with _declspec(dllexport) option and you can directly import the class from where the GUI is located. 2. Pass the handler to the edit box where the DLL class can display the output. |
|
Go4Expert Member
|
|
| 19Jun2006,15:26 | #5 |
|
i don't get it. if i am calling Func(), then how my mfc app can access m_counter while Func() is running?.
|
|
Go4Expert Founder
|
![]() |
| 20Jun2006,10:53 | #6 |
|
Check out Creating a simple DLL article. That will help you to get things moving.
|
|
Go4Expert Member
|
|
| 20Jun2006,12:08 | #7 |
|
Code:
#include "dll.h"
void CDll::ATestMethod()
{
m_c = 0;
for (int i = 0; i<1000; i++)
m_c++;
}
|
|
Go4Expert Founder
|
![]() |
| 20Jun2006,15:11 | #8 |
|
Quote:
Originally Posted by goT |
|
Go4Expert Member
|
|
| 20Jun2006,16:07 | #9 |
|
can you show me in actual code if i am not asking too much?.
|
|
Go4Expert Founder
|
![]() |
| 20Jun2006,19:49 | #10 |
|
Download the code from the above article and add a new function to the DLL
Code: CPP
Code: CPP
|
