Call standard Windows executables in C program

I used the function system()to call certmgr.exein my C code. After running my executable, the promt command appears, indicating that the certificate has been successfully installed.

But I do not want the promt command to be open. How to do it?

any other ways to call "exe" in C ...

thank,,

+5
source share
5 answers

The easiest way to do this on Windows is to invoke ShellExecute. Skip SW_HIDEto make sure the console window is not displayed.

Alternatively you can use CreateProcess, but a little harder to call. Use the flag CREATE_NO_WINDOWto disable the console window.

+5

cmd.exe / . start /B:

.

START [ "title" ] [/D path] [/I] [/MIN] [/MAX] [/ |/]       [/LOW |/NORMAL |/HIGH |/REALTIME |/ABOVENORMAL |/ ]       [/AFFINITY] [/WAIT] [/B] [/]       []

[...]     B .                  ^ C .                  ^ C, ^ Break -                 .

CreateProcess.

+3

WINAPI CreateProcess(), . , certmgr.exe ( ):

CREATE_NO_WINDOW , . .

+2

TED's answer to this link helped me finally ...

This may help someone in the future ...

Others mentioned using CreateProcess (supposedly to redirect output). A common reason for this is that the program that you run through the "system" is a command-line program. If this is what you compile, you can get rid of the console window by building it as a graphical program. You must do this by enabling Windows.h and using WinMain () as your entry point instead of main ()

0
source

All Articles