Tech Support Guy banner
Status
Not open for further replies.
1 - 7 of 7 Posts

·
Registered
Joined
·
277 Posts
Discussion Starter · #1 ·
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
 

·
Registered
Joined
·
277 Posts
Discussion Starter · #3 ·
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
 

·
Registered
Joined
·
277 Posts
Discussion Starter · #5 ·
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 :) :up:

Doctorzeus
 

·
Registered
Joined
·
277 Posts
Discussion Starter · #6 ·
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
 
1 - 7 of 7 Posts
Status
Not open for further replies.
Top