c# - Programmatically set console window size and position -
i open multiple console programs on desktop. have everytime: 1.right click desktop->screen resolution->detect (4 monitors). 2.open 16 different console programs (4 per screen). 3.clicking on windows z-order correctly. 3.right click taskbar->show windows stacked (to organize 16 windows perfect squares, 4 on each screen in order of z-index).
is there way part of programmatically go quicker?
you can use windows api move console window. use dllimport declare winapi functions want use:
[dllimport("kernel32.dll", setlasterror = true)] static extern intptr getconsolewindow(); [dllimport("user32.dll", setlasterror = true)] internal static extern bool movewindow(intptr hwnd, int x, int y, int nwidth, int nheight, bool brepaint);
then call them: e.g.
intptr ptr = getconsolewindow(); movewindow(ptr, 0, 0, 1000, 400, true);
you can use further winapi function setwindowpos
. can find dllimport syntax searching web pinvoke
, name of function. follow explanations there , in msdn.
Comments
Post a Comment