WriteConsole函数,WriteConsoleInput

BOOL WriteConsole(
HANDLE hConsoleOutput,
  const VOID* lpBuffer,
  DWORD nNumberOfCharsToWrite,
  LPDWORD lpNumberOfCharsWritten,
  LPVOID lpReserved
);

Parameters

hConsoleOutput
[in] Handle to the console screen buffer. The handle must have the GENERIC_READ access right. For more information, see Console Buffer Security and Access Rights.
lpBuffer
[in] Pointer to a buffer that contains characters to be written to the console screen buffer. The total size must be less than 64K.
nNumberOfCharsToWrite
[in] Number of TCHARs to write.
lpNumberOfCharsWritten
[out] Pointer to a variable that receives the number of TCHARs actually written.
lpReserved
Reserved; must be NULL


#include "stdafx.h"
#include <windows.h>
int main(int argc, char* argv[])
{
 printf("Hello World!\n");
 HANDLE stdout1 = GetStdHandle(STD_OUTPUT_HANDLE);
 DWORD z;
    char str[]="hello";
    WriteConsole(stdout1,str,sizeof(str),&z,NULL);
 return 0;
}
把内容输出到控制台

The WriteConsoleInput function writes data directly to the console input buffer.

 

BOOL WriteConsoleInput(
HANDLE hConsoleInput,
  const INPUT_RECORD* lpBuffer,
  DWORD nLength,
  LPDWORD lpNumberOfEventsWritten
);
posted @ 2007-09-06 10:40  ahuo  阅读(2864)  评论(0编辑  收藏  举报