#ifdef WIN32
PromptDialog* md = new PromptDialog(AfxGetMainWnd());
EnableWindow(AfxGetMainWnd()->GetSafeHwnd(),FALSE);
md->m_displaytext = "Initial output string.\r\n";
md->m_strEdit1 = ""; // No input default.
md->Create();
// Store the old stream handles
istream *in = &cin;
ostream *out = &cout;
ostream *err = &cerr;
// You can also specify the size of the input buffer you want. (No dire consequences for
// a small buffer.)
inWinStream win(md,3);
cin = win;
// You can also specify the size of the output buffer you want. (It will dump output as it
// is filled.) The default is 256
outWinStream wout(md);
cout = wout;
// You can also specify the size of the error buffer you want. (It will dynamically grow
// as needed.)
errWinStream werr(3);
cerr = werr;
// Tie the input to the output so that pending output will be flushed when input is
// needed.
cin.tie(&cout);
#endif // WIN32
|