Home > Back-end >  QProcess call bat program, how to hide the bat to open the CMD black box
QProcess call bat program, how to hide the bat to open the CMD black box

Time:10-24

I want to use QProcess call bat program and give bat after the incoming parameters, hidden bat runtime CMD black box open, online says the basic use of VBS file open bat, but tried QProcess does not invoke the VBS script, also written in the bat VBS command will flash a black box, the effect also can't accept it,

CodePudding user response:

Directly in the Windows API: CreateProceess

Be sure to use the qt:
 
QProcess process;
Process. SetCreateProcessArgumentsModifier ([] (QProcess: : CreateProcessArguments * args)
{
The args - & gt; Flags |=CREATE_NEW_CONSOLE;
The args - & gt; StartupInfo - & gt; DwFlags & amp;=~ STARTF_USESTDHANDLES;
The args - & gt; StartupInfo - & gt; DwFlags |=STARTF_USESHOWWINDOW;
The args - & gt; StartupInfo - & gt; WShowWindow=SW_HIDE;
});
Process. The start ("... ");

Need to # include & lt; Windows. H>
.
.

CodePudding user response:

Try: CMD/c
  • Related