Thread: i cant seem to get the process path properly

  1. #1
    Registered User
    Join Date
    Nov 2002

    i cant seem to get the process path properly

    #include <windows.h>
    #include <iostream>
    #include <Tlhelp32.h>
    //#pragma comment(lib,"Toolhelp.lib");
    using namespace std;
    PROCESSENTRY32 pe32;
    MODULEENTRY32 me32;
    void mod32();
    HANDLE Snap;
    HANDLE ModSnap;
    HANDLE h;
    int main()
    pe32.dwSize = sizeof(PROCESSENTRY32);
    Snap = CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
    if(Process32First(Snap, &pe32))
    while(Process32Next(Snap , &pe32))
    cout << pe32.szExeFile <<endl;
    //CloseToolhelp32Snapshot(Snap);  //cant get it to compile with this as well
    return 0;
    void mod32()
    ModSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,me32.th32ProcessID);
    me32.dwSize = sizeof(MODULEENTRY32);
    cout << me32.szExePath <<endl; //this only shows c:\windows\system.dll or something , i want the full exe paths to all processs's

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    ModSnap is not used... Haven't you seen any warning? Don't use globals, and you will avoid such problems.

    First member is always ignored...

    Why don't you take the sample and use it as a base for your program?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Understanding fork()
    By NuNn in forum C Programming
    Replies: 8
    Last Post: 02-27-2009, 12:09 PM
  2. Help needed in creating a process
    By sac_garg in forum C Programming
    Replies: 3
    Last Post: 10-01-2006, 01:40 AM
  3. Terminate Process by Specific FullFilePath
    By MattKamil in forum Windows Programming
    Replies: 1
    Last Post: 07-05-2006, 04:15 PM
  4. Almost finished with Round Robin algorithm
    By Shinobi-wan in forum C++ Programming
    Replies: 2
    Last Post: 12-19-2004, 03:00 PM
  5. Linux: Send keyboard input to background process
    By xErath in forum Tech Board
    Replies: 2
    Last Post: 12-09-2004, 07:02 PM