Click here to Skip to main content
15,891,657 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ Exceptions Pin
Zdeslav Vojkovic4-Jan-06 0:58
Zdeslav Vojkovic4-Jan-06 0:58 
Questionconnecting to server... Pin
Yuwraj4-Jan-06 0:00
Yuwraj4-Jan-06 0:00 
AnswerRe: connecting to server... Pin
sunit54-Jan-06 0:49
sunit54-Jan-06 0:49 
AnswerRe: connecting to server... Pin
Zdeslav Vojkovic4-Jan-06 0:49
Zdeslav Vojkovic4-Jan-06 0:49 
AnswerRe: connecting to server... Pin
ThatsAlok4-Jan-06 1:33
ThatsAlok4-Jan-06 1:33 
QuestionRe: connecting to server... Pin
David Crow4-Jan-06 4:33
David Crow4-Jan-06 4:33 
Questionhow can i check whether notepad.exe is running in taskmanager or not Pin
trinadh_t3-Jan-06 23:43
trinadh_t3-Jan-06 23:43 
AnswerRe: how can i check whether notepad.exe is running in taskmanager or not Pin
Owner drawn3-Jan-06 23:51
Owner drawn3-Jan-06 23:51 
Here is an example...

#include <windows.h>
#include <stdio.h>
#include "psapi.h"

void PrintProcessNameAndID( DWORD processID )
{
    char szProcessName[MAX_PATH] = "unknown";

    // Get a handle to the process.

    HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |
                                   PROCESS_VM_READ,
                                   FALSE, processID );

    // Get the process name.

    if (NULL != hProcess )
    {
        HMODULE hMod;
        DWORD cbNeeded;

        if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), 
             &cbNeeded) )
        {
            GetModuleBaseName( hProcess, hMod, szProcessName, 
                               sizeof(szProcessName) );
        }
        else return;
    }
    else return;

    // Print the process name and identifier.

    printf( "%s (Process ID: %u)\n", szProcessName, processID );

    CloseHandle( hProcess );
}

void main( )
{
    // Get the list of process identifiers.

    DWORD aProcesses[1024], cbNeeded, cProcesses;
    unsigned int i;

    if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) )
        return;

    // Calculate how many process identifiers were returned.

    cProcesses = cbNeeded / sizeof(DWORD);

    // Print the name and process identifier for each process.

    for ( i = 0; i < cProcesses; i++ )
        PrintProcessNameAndID( aProcesses[i] );
}


Love Forgives--Love Gives--Jesus is Love Smile | :)
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord


GeneralRe: how can i check whether notepad.exe is running in taskmanager or not Pin
trinadh_t4-Jan-06 0:06
trinadh_t4-Jan-06 0:06 
GeneralRe: how can i check whether notepad.exe is running in taskmanager or not Pin
Owner drawn4-Jan-06 0:13
Owner drawn4-Jan-06 0:13 
GeneralRe: how can i check whether notepad.exe is running in taskmanager or not Pin
<color>Aljechin 4-Jan-06 0:51
<color>Aljechin 4-Jan-06 0:51 
GeneralRe: how can i check whether notepad.exe is running in taskmanager or not Pin
vikas amin4-Jan-06 4:20
vikas amin4-Jan-06 4:20 
GeneralRe: how can i check whether notepad.exe is running in taskmanager or not Pin
Dudi Avramov5-Jan-06 0:46
Dudi Avramov5-Jan-06 0:46 
QuestionRe: how can i check whether notepad.exe is running in taskmanager or not Pin
David Crow9-Jan-06 4:23
David Crow9-Jan-06 4:23 
QuestionSynchronize time Pin
Le Sourcier3-Jan-06 23:16
Le Sourcier3-Jan-06 23:16 
AnswerRe: Synchronize time Pin
Prakash Nadar3-Jan-06 23:44
Prakash Nadar3-Jan-06 23:44 
GeneralRe: Synchronize time Pin
Le Sourcier3-Jan-06 23:54
Le Sourcier3-Jan-06 23:54 
AnswerRe: Synchronize time Pin
kakan4-Jan-06 0:24
professionalkakan4-Jan-06 0:24 
GeneralRe: Synchronize time Pin
Le Sourcier4-Jan-06 0:50
Le Sourcier4-Jan-06 0:50 
Questionhow to capture print spool file Pin
RUDOLFYAN3-Jan-06 22:53
RUDOLFYAN3-Jan-06 22:53 
AnswerRe: how to capture print spool file Pin
Garth J Lancaster3-Jan-06 23:24
professionalGarth J Lancaster3-Jan-06 23:24 
GeneralRe: how to capture print spool file Pin
RUDOLFYAN4-Jan-06 3:53
RUDOLFYAN4-Jan-06 3:53 
GeneralRe: how to capture print spool file Pin
Garth J Lancaster4-Jan-06 9:52
professionalGarth J Lancaster4-Jan-06 9:52 
GeneralRe: how to capture print spool file Pin
RUDOLFYAN4-Jan-06 16:39
RUDOLFYAN4-Jan-06 16:39 
GeneralRe: how to capture print spool file Pin
Garth J Lancaster4-Jan-06 17:55
professionalGarth J Lancaster4-Jan-06 17:55 

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.