Click here to Skip to main content
15,901,284 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWhat such code mean? Pin
kcynic21-Sep-07 19:04
kcynic21-Sep-07 19:04 
AnswerRe: What such code mean? Pin
nitin321-Sep-07 19:25
nitin321-Sep-07 19:25 
AnswerRe: What such code mean? Pin
prasad_som21-Sep-07 19:41
prasad_som21-Sep-07 19:41 
GeneralRe: What such code mean? Pin
kcynic21-Sep-07 21:35
kcynic21-Sep-07 21:35 
GeneralRe: What such code mean? Pin
kcynic21-Sep-07 22:03
kcynic21-Sep-07 22:03 
AnswerRe: What such code mean? Pin
John R. Shaw21-Sep-07 21:08
John R. Shaw21-Sep-07 21:08 
QuestionGetting the process that owns the window Pin
Tydia-kun21-Sep-07 10:24
Tydia-kun21-Sep-07 10:24 
AnswerRe: Getting the process that owns the window Pin
Mark Salsbery21-Sep-07 11:08
Mark Salsbery21-Sep-07 11:08 
The GetWindowThreadProcessId() API can help.

This came up recently here and I can't remember how to get the name from the process ID.

I think you need to enumerate the processes on the system and find the one that matches the ID.

A couple ways to enumerate processes:
CreateToolhelp32Snapshot()/Process32First()/Process32Next()
Use WMI and the Win32_Process class

Tydia-kun wrote:
It should be possible as it's the very same thing Task Manager does.


I'm not sure why task manager would use window handles to find processes when there's many
methods available for enumerating processes and task manager also shows processes that don't
have any windows.  I'd guess that task manager uses WMI.

Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: Getting the process that owns the window Pin
led mike21-Sep-07 11:22
led mike21-Sep-07 11:22 
GeneralRe: Getting the process that owns the window Pin
Mark Salsbery21-Sep-07 11:45
Mark Salsbery21-Sep-07 11:45 
AnswerRe: Getting the process that owns the window Pin
Mark Salsbery21-Sep-07 11:20
Mark Salsbery21-Sep-07 11:20 
GeneralRe: Getting the process that owns the window Pin
led mike21-Sep-07 11:26
led mike21-Sep-07 11:26 
GeneralRe: Getting the process that owns the window Pin
Mark Salsbery21-Sep-07 11:52
Mark Salsbery21-Sep-07 11:52 
GeneralRe: Getting the process that owns the window Pin
Tydia-kun21-Sep-07 11:39
Tydia-kun21-Sep-07 11:39 
GeneralRe: Getting the process that owns the window Pin
Mark Salsbery21-Sep-07 11:49
Mark Salsbery21-Sep-07 11:49 
GeneralRe: Getting the process that owns the window Pin
Tydia-kun21-Sep-07 12:29
Tydia-kun21-Sep-07 12:29 
GeneralRe: Getting the process that owns the window Pin
Mark Salsbery21-Sep-07 12:34
Mark Salsbery21-Sep-07 12:34 
GeneralRe: Getting the process that owns the window Pin
Tydia-kun21-Sep-07 12:44
Tydia-kun21-Sep-07 12:44 
GeneralRe: Getting the process that owns the window Pin
Mark Salsbery21-Sep-07 12:47
Mark Salsbery21-Sep-07 12:47 
GeneralRe: Getting the process that owns the window Pin
Tydia-kun21-Sep-07 12:50
Tydia-kun21-Sep-07 12:50 
GeneralRe: Getting the process that owns the window Pin
Mark Salsbery21-Sep-07 12:53
Mark Salsbery21-Sep-07 12:53 
GeneralRe: Getting the process that owns the window Pin
led mike24-Sep-07 4:40
led mike24-Sep-07 4:40 
GeneralRe: Getting the process that owns the window Pin
Mark Salsbery21-Sep-07 12:37
Mark Salsbery21-Sep-07 12:37 
GeneralRe: Getting the process that owns the window Pin
Tydia-kun21-Sep-07 12:46
Tydia-kun21-Sep-07 12:46 
GeneralRe: Getting the process that owns the window Pin
Mark Salsbery21-Sep-07 12:50
Mark Salsbery21-Sep-07 12:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.