Use code to control the location size of New Console

zhaozj2021-02-16  187

I answered a question in the forum, and I wrote it.

/ / -------------------------------------------------------------------------------------------- ----------------------

CreateNewConsole (Ansistring & Name, Int X, Int Y, Int Width, Int Height)

{

Process_information pi;

Startupinfo Si;

Security_attributes sa;

ZeromeMory (& Si, SIZEOF (Si));

Si.cb = sizeof (si);

Si.WShowWindow = sw_show;

Si.dwflags = startf_useshowwindow | startf_useposition | startf_usesize;

Si.dwx = x;

Si.dwy = y;

Si.dwxsize = width;

Si.dwysize = height;

CreateProcess (NULL,

Name.c_str (),

NULL,

NULL,

True,

CREATE_NEW_CONSOLE,

NULL,

NULL,

& Si,

& pi);

}

/ / -------------------------------------------------------------------------------------------- ----------------------

Void __fastcall tform1 :: button1click (Tobject * Sender)

{

INT X, Y, Width, Height;

X = 10; y = 50;

Width = 10; height = 5;

For (int i = 0; i <5; i )

{

CreateNewConsole ("cmd.exe", x, y, width, height);

X = 150;

}

}

转载请注明原文地址:https://www.9cbs.com/read-8549.html

New Post(0)