Discussion Locked

How do I get Task ID

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How do I get my own Task ID in VB6. (I know I can use Shell to start and retrieve one, I just want my own!)

1 reply

by chucksomerville

Um... "Task ID"?

App.ThreadID returns the thread ID.

App.hInstance returns the instance handle. (Not very useful in Win32 - See Dan Appleman's "Visual Basic Programmer's Giude to the Win32 API", page 1104.)

If you mean the Process ID (as shown in Task Manager, and as used by the kill command at a command prompt), then declare the following API call...

Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long

...(note this may have wrapped in your browser window), and call it thus...

LabelPID.Caption = Str(GetCurrentProcessId())

- Cheers,

Chuck Somerville, Dayton Ohio

This discussion is closed to new replies.