Moving console?

So I tried moving the console that I'm opening, and found about SetWindowPos method inside user32.dll and so I tried it using the code below

Code:
    hwnd = Win32API.new('user32.dll', 'FindWindow', 'PP','N').call(0, game_title)    Win32API.new('kernel32.dll', 'AllocConsole', '', '').call    Win32API.new('kernel32.dll', 'SetConsoleTitle', 'P', '').call(game_title + ': Message Console')    cons = Win32API.new('user32.dll', 'FindWindow', 'PP','N').call(0, game_title + ': Message Console')    $stdout.reopen('CONOUT$')    Win32API.new('user32.dll', 'SetForegroundWindow', 'P', '').call(hwnd)    Win32API.new('user32.dll','SetWindowPos','PPPPPP','').call(cons,hwnd,0,0,544,416)
The console that I just made didn't move (both playtest and from opening the game itself). I also tried it with the game window but it also didn't move. Anybody know the problem? Thanks in advance 🙂
con_hwnd = Win32API.new('kernel32', 'GetConsoleWindow', 'V', 'L').call
flags = 0x0004 | 0x0010 # SWP_NOZORDER | SWP_NOACTIVATE


Win32API.new('user32', 'SetWindowPos', 'LLLLLLL', 'L').call(con_hwnd, 0, 0, 0, 544, 416, flags)

You forgot the uFlags parameter. You didn't even pass zero. I gave an example for those flags, but you can change them to whatever you need (including zero).
Ah I see... Gonna try that one. Thanks 🙂


EDIT: Tried it, first didn't work. Then I replaced my find window with your get console and it finally worked. Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/moving-console.33989/