Why is the API returning zero?#include once "windows.bi"
Dim As Handle hOut = GetStdHandle( STD_OUTPUT_HANDLE )
Print SetConsoleScreenBufferSize(hOut, Type <COORD>(40, 60))
Print "FreeBASIC"
Sleep
Windows API returning zero
-
- Posts: 4675
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Windows API returning zero
-
- Posts: 4675
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: Windows API returning zero
<COORD>(100, 40)
That returned 1
I need to read dwSize [in] in Parameters.a few times. It looks it was written on a Friday afternoon after a long liquid lunch.
That returned 1
I need to read dwSize [in] in Parameters.a few times. It looks it was written on a Friday afternoon after a long liquid lunch.
Re: Windows API returning zero
If you're making the window smaller, you have to resize the window then optionally the buffer.dwSize
A COORD structure that specifies the new size of the console screen buffer, in character rows and columns. The specified width and height cannot be less than the width and height of the console screen buffer's window. The specified dimensions also cannot be less than the minimum size allowed by the system.
If you're making the window bigger, you have to resize the buffer first then the window.
SetConsoleScreenBufferInfoEx will let you resize them both at the same time. You'll need to use GetConsoleScreenBufferInfoEx first to populate all the things you don't want to change like the colours or the cursor position.
The console buffer is what the console window shows. It doesn't make sense for it to be smaller than the window, so they don't let you do it.
-
- Posts: 4675
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: Windows API returning zero
Thanks adeyblue.
It looks like my opening post fell foul of your 'bold' sentence above.
<COORD>(100, 40) exceeded the window, so was OK.
It looks like my opening post fell foul of your 'bold' sentence above.
<COORD>(100, 40) exceeded the window, so was OK.