Re: Processes: Threads ?????
From: Tom Esh (tjeshGibberish_at_earthlink.net)
Date: 02/28/04
- Next message: TECH: "Re: Grabbing web pages programmatically"
- Previous message: Ran: "running a PIF file for DOS application using CreateProcess"
- In reply to: JonWayn: "Processes: Threads ?????"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 28 Feb 2004 15:57:03 -0500
On Sat, 28 Feb 2004 13:59:21 -0500, "JonWayn" <jongunn@bellsouth.net>
wrote:
> DazTask = ShellExecute(hDade, vbNullString, DazzleExePath, 0&,
>DazzlePath, SW_MINIMIZE)
> DoEvents
> hDade = Application.hWndAccessApp 'Get Dade application
>hwnd
> SetForegroundWindow (hDade) 'Set focus to Dade
> hAThread = GetWindowThreadProcessId(hDade, hAProcess)
>
>
>
>Just so I understand threads and processes a little more: I was reviewing my
>own codes (above) a little while ago, after learning that a process is
>basically an application and a thread is just any unit that requires
>processing attention, and also that the GetWindowThreadProcessId function
>gets the thread that owns the window indicated by its hwnd argument, and the
>process that created the window. I placed a break mark at the statement
>following the last statement above, just to see what the function would
>return in these 2 variables. I thought that since I opened this application
>from the user interface, then there shouldnt be any process that created the
>window - I was wrong: a non-zero value was returned for the process. Can
>someone make it clearer, what exactly is that process variable
>identifying? - what application? When I click to launch the app, what is the
>chain of events that took place prior to the actual opening of the window,
>with regards to the owner process and thread?
>
>I hope someone sees where I'm coming from and I didn't confuse the heck out
>of all of you!
On return, the variable you pass in the 2nd parameter of
GetWindowThreadProcessId is populated with the ID of the process that
owns the thread that owns the window. The return value is the ID of
the thread that owns the window.
Maybe this will help. The heirarchy is:
Process
Thread(s) belonging to the process
Window(s) belonging to a thread
1) A thread must belong to a process.
2) A window must belong to a thread (and therefore indirectly must
belong to a process).
3) A process ~must~ have at least one thread
4) A thread ~can~ exist without any windows, though in the case of a
VB app, the VB runtime always creates at least one non-visible window.
-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
- Next message: TECH: "Re: Grabbing web pages programmatically"
- Previous message: Ran: "running a PIF file for DOS application using CreateProcess"
- In reply to: JonWayn: "Processes: Threads ?????"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|