| |

VerySource

 Forgot password?
 Register
Search
View: 813|Reply: 6

Problems using the system function to execute the dos command in an MFC program

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-4 12:10:01
| Show all posts |Read mode
Ask a weak question:
Need to force close several processes when the program is closed, as follows

    system ("taskkill / F / IM CTT *");
    system ("taskkill / F / IM CTS *");
    system ("taskkill / F / IM LDA *");

However, popping up three windows is very depressing. How to implement multiple lines of commands in one system statement?
Reply

Use magic Report

1

Threads

15

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-1-4 22:54:01
| Show all posts
Write to the batch file, and then you system that bat file.
Reply

Use magic Report

1

Threads

15

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-1-4 23:45:01
| Show all posts
Agree upstairs
Reply

Use magic Report

0

Threads

10

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-5 09:51:01
| Show all posts
Yes, do it in batch
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-5 10:30:01
| Show all posts
system ("taskkill / F / IM CTT *\ntaskkill / F / IM CTT *\ntaskkill / F / IM CTT *\n");
I do n’t know. No.
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-1-6 10:42:01
| Show all posts
Upstairs, I tried.
Is there anything other than a batch file?
Wait until tomorrow night, if there is no answer, the post will be unveiled.
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-6 16:03:01
| Show all posts
Means that you put those commands into a batch bat file and then use system to call that bat
It is recommended to use WinExec or CreateProcess to hide the dos window
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list