Click here to Skip to main content
15,910,980 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Network I/O models Pin
Mike Dimmick13-May-04 3:27
Mike Dimmick13-May-04 3:27 
GeneralInstead a dialog I want to appear 3 buttons Pin
Filomela12-May-04 23:30
Filomela12-May-04 23:30 
GeneralRe: Instead a dialog I want to appear 3 buttons Pin
nguyenvhn13-May-04 1:50
nguyenvhn13-May-04 1:50 
GeneralRe: Instead a dialog I want to appear 3 buttons Pin
Filomela13-May-04 21:42
Filomela13-May-04 21:42 
GeneralRe: Instead a dialog I want to appear 3 buttons Pin
nguyenvhn13-May-04 22:41
nguyenvhn13-May-04 22:41 
GeneralTerminate a Named Program Pin
sweep12312-May-04 23:27
sweep12312-May-04 23:27 
GeneralRe: Terminate a Named Program Pin
Milton Karimbekallil12-May-04 23:56
Milton Karimbekallil12-May-04 23:56 
GeneralRe: Terminate a Named Program Pin
sweep12313-May-04 2:51
sweep12313-May-04 2:51 
Thanks for the information and link.

I included the following code into an ABort button, but did not manage to terminate the other application, any ideas?

HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
PROCESSENTRY32* processInfo=new PROCESSENTRY32;
processInfo->dwSize=sizeof(PROCESSENTRY32);
int index = 0;
int processID = 0;
bool handleFound = false;
HANDLE CSLProcess = NULL;

// Here we are passing snapshot handle and PROCESSENTRY32 structure to Process32Next()
// function. After execution, PROCESSENTRY32 structure will contain information about a process.
// We are iterating through a loop until we got FALSE and this means there is now no process left to visit in snapshot and our pointer is at the end of snapshot.

Process32First(hSnapShot,processInfo);
if(strcmp(processInfo->szExeFile,"Csl.exe") == 0)
{
handleFound = true;
processID = processInfo->th32ParentProcessID;
}

while((Process32Next(hSnapShot,processInfo)!=FALSE) && (handleFound == false))
{
if(strcmp(processInfo->szExeFile,"Csl.exe") == 0)
{
handleFound = true;
processID = processInfo->th32ProcessID;
break;
}
}

CSLProcess = OpenProcess(PROCESS_TERMINATE,TRUE,processID);


if(!CSLProcess)
if(TerminateProcess(CSLProcess, 0) == 0)
{
m_strGeneral = "Failed to Terminate CSL.EXE No Assecc Rights";
m_strOutput+= m_strGeneral + crlf; // Total display string; adding m_strNewText at the end
m_Output.SetWindowText(m_strOutput); // Display the new text appended onto the old text
}
else
{
m_strGeneral = "Failed to Terminate CSL.EXE";
m_strOutput+= m_strGeneral + crlf; // Total display string; adding m_strNewText at the end
m_Output.SetWindowText(m_strOutput); // Display the new text appended onto the old text
}

//Don’t forget to close handle.
CloseHandle(hSnapShot);

delete processInfo;
GeneralRe: Terminate a Named Program Pin
jmkhael13-May-04 4:55
jmkhael13-May-04 4:55 
GeneralRe: Terminate a Named Program Pin
sweep12313-May-04 5:57
sweep12313-May-04 5:57 
GeneralKeeping variables in memory Pin
V.12-May-04 23:14
professionalV.12-May-04 23:14 
GeneralRe: Keeping variables in memory Pin
jmkhael13-May-04 2:22
jmkhael13-May-04 2:22 
GeneralRe: Keeping variables in memory Pin
Joe Woodbury13-May-04 9:15
professionalJoe Woodbury13-May-04 9:15 
Generalmessy function that calculates values Pin
bhangie12-May-04 22:40
bhangie12-May-04 22:40 
GeneralRe: messy function that calculates values Pin
toxcct12-May-04 22:56
toxcct12-May-04 22:56 
GeneralRe: messy function that calculates values Pin
WoutL12-May-04 23:11
WoutL12-May-04 23:11 
GeneralRe: messy function that calculates values Pin
Maximilien13-May-04 2:08
Maximilien13-May-04 2:08 
GeneralRe: messy function that calculates values Pin
David Crow13-May-04 5:30
David Crow13-May-04 5:30 
GeneralRe: messy function that calculates values Pin
vividtang14-May-04 2:27
vividtang14-May-04 2:27 
GeneralAlpha-channel in the bitmap Pin
Eugene Pustovoyt12-May-04 22:23
Eugene Pustovoyt12-May-04 22:23 
GeneralRe: Alpha-channel in the bitmap Pin
Christopher Lloyd13-May-04 2:17
Christopher Lloyd13-May-04 2:17 
GeneralRe: Alpha-channel in the bitmap Pin
Eugene Pustovoyt13-May-04 2:56
Eugene Pustovoyt13-May-04 2:56 
GeneralRe: Alpha-channel in the bitmap Pin
Christopher Lloyd13-May-04 3:13
Christopher Lloyd13-May-04 3:13 
General//Need help in Directshow programming Pin
12-May-04 22:14
suss12-May-04 22:14 
GeneralRe: //Need help in Directshow programming Pin
Christopher Lloyd13-May-04 2:41
Christopher Lloyd13-May-04 2:41 

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.