Board logo

Subject: bcb 使用CnConsole [Print This Page]

Author: fbms    Time: 2011-12-20 09:21     Subject: bcb 使用CnConsole



[Copy to clipboard]
CODE:
void WriteLn(String text)
{
  static HANDLE handle;
  if (!handle) {
    AllocConsole();
    handle = GetStdHandle(STD_OUTPUT_HANDLE);
  }
  text += "\n";
  WriteConsole(handle,
    text.c_str(), text.Length(), 0, 0);
}

//---------------------------------------------------------------------------
void __fastcall TForm1::CnButton1Click(TObject *Sender)
{
WriteLn ("this is a test");
}


Author: fbms    Time: 2011-12-20 09:23

。。。其实不放cnconsole一样弹出来控制台,囧。
Author: Passion    Time: 2011-12-20 17:11

CnConsole组件确实就是对AllocConsole等API的封装。




Welcome to CnPack Forum (http://bbs.cnpack.org/) Powered by Discuz! 5.0.0