CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2003
    Location
    VN
    Posts
    9

    How to get path of an executable file?

    I used "CreateToolhelp32Snapshot()" and "Process32Next()" to get information of a process and store it in "PROCESSENTRY32".

    Question:
    How can I get full path of executable file? ("szExeFile" property just store name of executable file.)
    Thank you!

  2. #2
    Join Date
    Sep 2002
    Location
    Singapore
    Posts
    673
    Hope it helps

    http://www.codeguru.com/forum/showth...plication+path

    The answer is using Win32 API, despite the thread title.

  3. #3
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Take a look at this FAQ...

  4. #4
    Join Date
    Mar 2003
    Location
    Romania
    Posts
    9

    Simple

    char szPath[512]="";
    GetModuleFileName(GetModuleHandle(NULL),szPath,sizeof(szPath));


    replace GetModuleHandle(NULL) - with the one of the running file
    I am the mighty keeper of the book of knowledge ! Contact me for a copy !
    --------
    http://www.codeproject.com/script/Ar...p?userid=47637

  5. #5
    Join Date
    Feb 2001
    Posts
    47
    Heh, I was just about to post exactly the same question - talk about coincidences...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured