标签: realstudio

由于参数无效,GetConsoleScreenBufferInfoEx失败

我试图从控制台应用程序调用GetConsoleScreenBufferInfoEx函数.如果重要,该应用程序是在64位Windows 7上运行的32位应用程序.该语言是RealBasic.

我相信我已经正确定义了所有结构,并且缓冲区输出句柄适用于所调用的每个其他API函数:

  Declare Function GetConsoleScreenBufferInfoEx Lib "Kernel32" (cHandle As Integer, ByRef info As CONSOLE_SCREEN_BUFFER_INFOEX) As Boolean
  Declare Function GetLastError Lib "Kernel32" () As Integer
  Declare Function GetStdHandle Lib "Kernel32" (hIOStreamType As Integer) As Integer

  Const STD_OUTPUT_HANDLE = -11
  Dim stdHandle As Integer = GetStdHandle(STD_OUTPUT_HANDLE)

  Dim err As Integer
  Dim info As CONSOLE_SCREEN_BUFFER_INFOEX

  If GetConsoleScreenBufferInfoEx(stdHandle, info) Then
    Break
  Else
    err = GetLastError  //Always 87, Invalid parameter
    Break
  End If
Run Code Online (Sandbox Code Playgroud)

结构:

Structure CONSOLE_SCREEN_BUFFER_INFOEX
  cbSize As Integer
  dwSize As COORD …
Run Code Online (Sandbox Code Playgroud)

console winapi realbasic realstudio

4
推荐指数
1
解决办法
889
查看次数

标签 统计

console ×1

realbasic ×1

realstudio ×1

winapi ×1