CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Posts
    15

    Howto: from HWND to EXE ???

    If I know an windows handle, how can I find out the exe name and path (and the Process ID)of the application owning it?



  2. #2
    Join Date
    Apr 1999
    Posts
    48

    Re: Howto: from HWND to EXE ???

    GetWindowThreadProcessId()

    Can get the Process ID. Don't know how to leap from there to the exe name and path though unfortunately.


    Roger



  3. #3
    Join Date
    May 1999
    Posts
    116

    Re: Howto: from HWND to EXE ???

    GetWindowModuleFileName()


  4. #4
    Join Date
    May 1999
    Posts
    24

    Re: Howto: from HWND to EXE ???

    You should call next functions:

    1. Get WindowThreadProcessId(...) to get Process ID from HWND;
    2. OpenProcess(...) or GetProcessInformation(...) to get HANDLE to the process;
    3. EnumProcessModules(...) to get HANDLEs to all modules of the process;
    4. GetModuleFileName(...) to get path to module's file.

    Actually, I had the reverse problem. And I solved it.
    I think this should work.


    Thanks,
    Ilgar Mashayev

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