[英]Window api size and move a console
我正在嘗試使一個函數成為允許我在Windows上移動和調整控制台大小的函數。 目前我做到了:
int CMD::setSizeAndMove(int top, int left, int width, int height)
//Here we change the size of the window, if the buffer is ok, and change the position
{
SMALL_RECT rect;
rect.Top = top;
rect.Left = left;
rect.Bottom = height;
rect.Right = width;
return SetConsoleWindowInfo(m_consoleHandle, true, &rect);
}
緩沖區還可以。 我試圖找出錯誤,但我得到了一個。 錯誤n°87:參數無效:參數不正確。
如何解決這個問題,我不是很了解我做錯了什么。
您的代碼中似乎有一個錯誤:
SMALL_RECT rect;
rect.Top = top;
rect.Left = left;
rect.Bottom = height;
rect.Right = width;
height
的含義與bottom
的含義不同。 對於width
和right
同樣如此。 嘗試更改為以下內容:
SMALL_RECT rect;
rect.Top = top;
rect.Left = left;
rect.Bottom = height + top;
rect.Right = width + left;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.