1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Get Window Process ID

Discussion in 'Software Development' started by doctorzeus, Dec 30, 2010.

Thread Status:
Not open for further replies.
Advertisement
  1. doctorzeus

    doctorzeus Thread Starter

    Joined:
    Jun 10, 2010
    Messages:
    277
    Hello,

    I am wondering whats the best way of getting the Proc ID of the currently active window in C/C++?

    I suspect I have to use Hwnd but I am not really sure how to do it...

    Anyone have any suggestions?

    Thanks

    Doctorzeus
     
  2. DaBeers

    DaBeers

    Joined:
    Oct 30, 2008
    Messages:
    276
    This is not my language but I figured I give helping a try anyway. It seemed like an easy enough problem.
    I was able to find what appears to be some helpful code on the issue. I wish I understood it a little better.
    http://www.cplusplus.com/forum/windows/12137/

    GL,
     
  3. doctorzeus

    doctorzeus Thread Starter

    Joined:
    Jun 10, 2010
    Messages:
    277
    Thats helpfull thanks :)

    However I still need a way of getting the window name automatically, that takes in the windowname as a wide string via the user entering it manually..I was wondering how to get one automatically from the currently active window?

    Thanks

    Doctorzeus
     
  4. DaBeers

    DaBeers

    Joined:
    Oct 30, 2008
    Messages:
    276
  5. doctorzeus

    doctorzeus Thread Starter

    Joined:
    Jun 10, 2010
    Messages:
    277
    Thats C# sorry, functions like GetForeGroundWindow() don't apply to C/C++

    However Looking around I found this:

    http://www.daniweb.com/forums/thread139828.html

    As I guessed the concepts based around HWND...however thats still for a specific Process :mad:, will continue looking..

    What language do you usually use?

    Thanks for the Help :) (y)

    Doctorzeus
     
  6. doctorzeus

    doctorzeus Thread Starter

    Joined:
    Jun 10, 2010
    Messages:
    277
    Ok I just found out about this but havn't tried it...

    I think I can use the

    Code:
    GetWindowThreadProcessId()
    function...

    Will post how it goes..

    Doctorzeus
     
  7. doctorzeus

    doctorzeus Thread Starter

    Joined:
    Jun 10, 2010
    Messages:
    277
  8. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Solved Window Process
  1. muckmail
    Replies:
    16
    Views:
    1,176
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/971564

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice