But somehow that doesn't work with consoles.
I found this module. But it doesn't work. I want to move the console window.
Code: Select all
DeclareModule CONSOLE
Declare.i Create()
Declare.i Resize(Width.i,Height.i,FontWidth.i,FontHeight)
EndDeclareModule
Module CONSOLE
EnableExplicit
Import "kernel32.lib"
SetCurrentConsoleFontEx.i(hConsoleOutput.i,bMaximumWindow.b,*lpConsoleCurrentFontEx)
GetConsoleScreenBufferInfoEx.i(hConsoleOutput.i,*lpConsoleScreenBufferInfoEx)
EndImport
Structure CONSOLE_FONT_INFOEX
cbSize.l
nFont.l
dwFontSize.COORD
FontFamily.l
FontWeight.l
FaceName.u[#LF_FACESIZE]
EndStructure
Structure CONSOLE_COORD_STRUCT
StructureUnion
value.l
coord.COORD
EndStructureUnion
EndStructure
Structure CONSOLE_STRUCT
std_in.i
std_out.i
EndStructure
Global console.CONSOLE_STRUCT
Procedure.i Create()
FreeConsole_()
If AllocConsole_()
console\std_in = GetStdHandle_(#STD_INPUT_HANDLE)
console\std_out = GetStdHandle_(#STD_OUTPUT_HANDLE)
ProcedureReturn #True
EndIf
ProcedureReturn #False
EndProcedure
Procedure.i Resize(Width.i,Height.i,FontWidth.i,FontHeight)
Protected wnd_rect.SMALL_RECT
Protected scr_size.CONSOLE_COORD_STRUCT
Protected font.CONSOLE_FONT_INFOEX
Protected font_name.s
Protected font_bytes.i
Protected scr_info.CONSOLE_SCREEN_BUFFER_INFO
wnd_rect\right = 1
wnd_rect\bottom = 1
If SetConsoleWindowInfo_(console\std_out,#True,@wnd_rect);<- make window as small as possible for resize
scr_size\coord\x = Width
scr_size\coord\y = Height
If SetConsoleScreenBufferSize_(console\std_out,scr_size\value);<- create the screen buffer
If SetConsoleActiveScreenBuffer_(console\std_out);<- use the created screen buffer
font\cbSize = SizeOf(CONSOLE_FONT_INFOEX)
font\dwFontSize\x = FontWidth
font\dwFontSize\y = FontHeight
font\FontFamily = #FF_DONTCARE
font\FontWeight = #FW_NORMAL
font_name = "Consolas"
font_bytes = (Len(font_name) + 1) * SizeOf(Character)
If Not font_bytes > #LF_FACESIZE
CopyMemory(@font_name,@font\FaceName[0],font_bytes)
If SetCurrentConsoleFontEx(console\std_out,#False,@font);<- set console font
;------ EVERYTHING SEEMS TO WORK UNTIL HERE!!!------
If GetConsoleScreenBufferInfo_(console\std_out,@scr_info);<- get current info
Debug scr_info\dwMaximumWindowSize\x;<- why? (should show allowed screem size)?
Debug scr_info\dwMaximumWindowSize\y;<- why?
wnd_rect\right = Width
wnd_rect\bottom = Height
Debug SetConsoleWindowInfo_(console\std_out,#True,@wnd_rect);why? <- should resize the window!?
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
ProcedureReturn #False
EndProcedure
EndModule
CONSOLE::Create()
CONSOLE::Resize(1080,720,16,16)
Repeat
Delay(1)
ForEver