Click here to Skip to main content
16,006,594 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionA mistake when submit aticle Pin
includeh1029-Mar-06 9:22
includeh1029-Mar-06 9:22 
AnswerRe: A mistake when submit aticle Pin
David Crow29-Mar-06 9:29
David Crow29-Mar-06 9:29 
GeneralRe: A mistake when submit aticle Pin
includeh1029-Mar-06 16:41
includeh1029-Mar-06 16:41 
QuestionProblems with Button Tooltips Pin
big_denny_20029-Mar-06 8:59
big_denny_20029-Mar-06 8:59 
AnswerRe: Problems with Button Tooltips Pin
Hamid_RT29-Mar-06 17:59
Hamid_RT29-Mar-06 17:59 
Questionhow to control wm asf writer by Imediaseeking? Pin
yongwpi29-Mar-06 7:42
yongwpi29-Mar-06 7:42 
Questionhow to get the current row in DataGrid? Pin
Dimkov29-Mar-06 7:12
Dimkov29-Mar-06 7:12 
QuestionClosing multiple processes at once Pin
eprt29-Mar-06 5:05
eprt29-Mar-06 5:05 
Hello, I'm trying to create a program that will allow me to launch various applications as many times as I want, and also close them all at once. So far I have manage to code the launch part. my program runs and gives the choice to execute three programs: notepad, calculator, and paint. I can keep on crating as many isntances as I want of any of the three programs. However, I have not been able to come up with a solution to close all of the open programs at once, this will be done when the option 4 is selected from the menu!! So far my program only closes the last opened application, but not the rest..How can I come about resolving this problem thank you.. here is my code::
#include windows.h
#include stdio.h
#include stdlib.h

#include "linkedlist.h"(structure contains: PROCESS_INFORMATION si, and *next node)


void P1();
void P2();
void P3();

void main(void)
{


Node *head = NULL;
Node *newPtr = new Node;


STARTUPINFO si;
//PROCESS_INFORMATION pi;

ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
//ZeroMemory(&pi, sizeof(pi));

int num=0;
while(num!=5){
//char ch ='0';
//char skip[31]="";
system("cls");
printf("\t\t****Select which application to execute *****\n\n"
"\t\t\t1.NotePad\n \t\t\t2.Calculator\n \t\t\t3.Paint\n\t\t\t4.Quit\n\n");

scanf("%d", &num);

if (num==1){

CreateProcess(NULL,"C:\\Windows\\System32\\Notepad.exe",NULL,NULL,NULL,NULL,NULL,NULL,&si,&newPtr->pi);


}

if(num==2){
CreateProcess(NULL,"C:\\Windows\\System32\\Calc.exe",NULL,NULL,NULL,NULL,NULL,NULL,&si,&newPtr->pi);

}

if(num==3){
CreateProcess(NULL,"C:\\Windows\\System32\\Mspaint.exe",NULL,NULL,NULL,NULL,NULL,NULL,&si,&newPtr->pi);

}

if (num==4){

TerminateProcess(newPtr->pi.hProcess,0);
TerminateProcess(newPtr->pi.hThread,0);

}


}


}



-- modified at 11:06 Wednesday 29th March, 2006
AnswerRe: Closing multiple processes at once Pin
David Crow29-Mar-06 5:56
David Crow29-Mar-06 5:56 
GeneralRe: Closing multiple processes at once Pin
eprt29-Mar-06 6:16
eprt29-Mar-06 6:16 
GeneralRe: Closing multiple processes at once Pin
David Crow29-Mar-06 6:35
David Crow29-Mar-06 6:35 
AnswerRe: Closing multiple processes at once Pin
Nemanja Trifunovic29-Mar-06 8:40
Nemanja Trifunovic29-Mar-06 8:40 
GeneralRe: Closing multiple processes at once Pin
David Crow29-Mar-06 9:38
David Crow29-Mar-06 9:38 
AnswerRe: Closing multiple processes at once Pin
Stephen Hewitt29-Mar-06 13:01
Stephen Hewitt29-Mar-06 13:01 
Questiondialog not in taskbar Pin
viperlogic29-Mar-06 4:55
viperlogic29-Mar-06 4:55 
AnswerRe: dialog not in taskbar Pin
viperlogic29-Mar-06 5:04
viperlogic29-Mar-06 5:04 
AnswerRe: dialog not in taskbar Pin
toxcct29-Mar-06 5:06
toxcct29-Mar-06 5:06 
GeneralRe: dialog not in taskbar Pin
viperlogic29-Mar-06 5:12
viperlogic29-Mar-06 5:12 
QuestionHow to offer aticles here? Pin
includeh1029-Mar-06 4:37
includeh1029-Mar-06 4:37 
AnswerRe: How to offer aticles here? Pin
Gavin Taylor29-Mar-06 4:44
professionalGavin Taylor29-Mar-06 4:44 
GeneralRe: How to offer aticles here? Pin
includeh1029-Mar-06 5:03
includeh1029-Mar-06 5:03 
GeneralRe: How to offer aticles here? Pin
Gavin Taylor29-Mar-06 5:08
professionalGavin Taylor29-Mar-06 5:08 
QuestionCopy contents of a window to the clipboard Pin
anderslundsgard29-Mar-06 4:12
anderslundsgard29-Mar-06 4:12 
AnswerRe: Copy contents of a window to the clipboard Pin
includeh1029-Mar-06 4:24
includeh1029-Mar-06 4:24 
AnswerRe: Copy contents of a window to the clipboard Pin
David Crow29-Mar-06 4:49
David Crow29-Mar-06 4:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.