Solved: Get Window Process ID

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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
 

doctorzeus

Thread Starter
Joined
Jun 10, 2010
Messages
277
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,
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
 

doctorzeus

Thread Starter
Joined
Jun 10, 2010
Messages
277
My ignorance really shows in that I thought that the third code block was going to do that.

I looked around a little and found this:
http://stackoverflow.com/questions/...he-title-of-the-current-active-window-using-c
Maybe you can merge the two concepts together?

GL,
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
 

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
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Members online

Top