CnPack Forum » CnVCL 组件包 » bcb 使用CnConsole


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

[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");
}[/code]

2011-12-20 09:23 fbms
。。。其实不放cnconsole一样弹出来控制台,囧。

2011-12-20 17:11 Passion
CnConsole组件确实就是对AllocConsole等API的封装。:)

页: [1]
查看完整版本: bcb 使用CnConsole


Powered by Discuz! Archiver 5.0.0  © 2001-2006 Comsenz Inc.