Click here to Skip to main content
15,921,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCRichEditCtrl question.. Pin
Anonymous3-Nov-02 4:10
Anonymous3-Nov-02 4:10 
GeneralRe: CRichEditCtrl question.. Pin
Stephane Rodriguez.3-Nov-02 7:25
Stephane Rodriguez.3-Nov-02 7:25 
GeneralHELP! Can not control Default Printer! Pin
Anonymous3-Nov-02 4:04
Anonymous3-Nov-02 4:04 
GeneralWindows 98 Disdain Pin
Swinefeaster3-Nov-02 0:00
Swinefeaster3-Nov-02 0:00 
GeneralRe: Windows 98 Disdain Pin
Stephane Rodriguez.3-Nov-02 7:28
Stephane Rodriguez.3-Nov-02 7:28 
GeneralRe: Windows 98 Disdain Pin
Swinefeaster3-Nov-02 11:14
Swinefeaster3-Nov-02 11:14 
GeneralRe: Windows 98 Disdain Pin
Stephane Rodriguez.3-Nov-02 18:44
Stephane Rodriguez.3-Nov-02 18:44 
GeneralEnumerating processes under Win9x Pin
Kuniva2-Nov-02 23:11
Kuniva2-Nov-02 23:11 
I downloaded this sample from MSDN about enumerating processes under Win9x. It uses Psapi.dll (so includes Psapi.h) to access functions used to retrieve all running processes, here is the code:

#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] );
}


Now when i try to compile this is compiles fine, but when it runs it gives me the error: "The PSAPI.DLL file is lonked to missing export NTDLL.DLL:NtAllocateVirtualMemory"

Now i did a search for NTDLL.DLL and it is in my windows system directory, so i opened it up with Dependency viewer and it could not find a function NtAllocateVirtualMemory.
Now what is wrong here? do i have a wrong DLL?? Even if i did, there is another question i asked myself. You see i opened up Taskmon.exe in Dependency viewer and it just uses the standard libraries like GDI.DLL, USER32.DLL, etc...
So it has to be possible to enumerate processes without the PSAPI so you can avoid the DLL problem. I wouldn't know how though...
If anyone has any ideas, please share them, any help is appreciated.
Thanks

Kuniva
--------------------------------------------
GeneralRe: Enumerating processes under Win9x Pin
Stephane Rodriguez.3-Nov-02 7:16
Stephane Rodriguez.3-Nov-02 7:16 
GeneralRe: Enumerating processes under Win9x Pin
Stephane Rodriguez.3-Nov-02 7:21
Stephane Rodriguez.3-Nov-02 7:21 
GeneralOnPaint question Pin
Mel Feik2-Nov-02 21:38
Mel Feik2-Nov-02 21:38 
GeneralRe: OnPaint question Pin
Stephane Rodriguez.2-Nov-02 22:04
Stephane Rodriguez.2-Nov-02 22:04 
GeneralRe: OnPaint question Pin
Mel Feik2-Nov-02 22:12
Mel Feik2-Nov-02 22:12 
GeneralRe: OnPaint question Pin
Stephane Rodriguez.2-Nov-02 22:14
Stephane Rodriguez.2-Nov-02 22:14 
GeneralRe: OnPaint question Pin
Mel Feik2-Nov-02 22:17
Mel Feik2-Nov-02 22:17 
GeneralRe: OnPaint question Pin
Mel Feik2-Nov-02 22:21
Mel Feik2-Nov-02 22:21 
GeneralRe: OnPaint question Pin
Gary R. Wheeler3-Nov-02 4:20
Gary R. Wheeler3-Nov-02 4:20 
GeneralRe: OnPaint question Pin
Ed Gadziemski3-Nov-02 4:21
professionalEd Gadziemski3-Nov-02 4:21 
QuestionI want my program able to burn a CD/DVD, how? Pin
Hiusing2-Nov-02 21:13
Hiusing2-Nov-02 21:13 
AnswerRe: I want my program able to burn a CD/DVD, how? Pin
Daniel Turini2-Nov-02 21:36
Daniel Turini2-Nov-02 21:36 
AnswerRe: I want my program able to burn a CD/DVD, how? Pin
Rickard Andersson203-Nov-02 2:41
Rickard Andersson203-Nov-02 2:41 
GeneralRe: I want my program able to burn a CD/DVD, how? Pin
Kelly Herald3-Nov-02 17:08
Kelly Herald3-Nov-02 17:08 
GeneralA few newbie questions about MFC Pin
Locked Ghost2-Nov-02 20:52
sussLocked Ghost2-Nov-02 20:52 
GeneralRe: A few newbie questions about MFC Pin
Stephane Rodriguez.2-Nov-02 22:02
Stephane Rodriguez.2-Nov-02 22:02 
GeneralRe: A few newbie questions about MFC Pin
S O S3-Nov-02 3:27
S O S3-Nov-02 3:27 

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.