Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting Session ID of a process

963 views
Skip to first unread message

Michael J. Leaver

unread,
Feb 13, 2008, 11:27:29 PM2/13/08
to
Hi, does anyone have any example Delphi code of getting the session ID
of the current process? When I say session ID, I mean the same session
ID that is shown in the Windows Task Manager, and not something related
to web servers.

Thanks

Rob Kennedy

unread,
Feb 14, 2008, 12:05:29 AM2/14/08
to

I'm not familiar with any column named "session ID" in Task Manager. Do
you mean the process ID? That's easy to get: GetCurrentProcessID.

--
Rob

Michael J. Leaver

unread,
Feb 14, 2008, 2:09:09 AM2/14/08
to

No, I really do mean the session ID :) Run the Windows Task Manager, go
to the main menu and select View -> Select Columns..., and you can see
Session ID in the lower left (assuming you are using Windows XP it is
between I/O Read Bytes and User Name).

Thanks

Igor Savkic

unread,
Feb 14, 2008, 4:51:00 AM2/14/08
to
> Hi, does anyone have any example Delphi code of getting the session ID
> of the current process? When I say session ID, I mean the same session

var
SessionId: DWORD;
begin
if ProcessIdToSessionId(GetCurrentProcessId, SessionId) then
Caption := IntToStr(SessionId);
end;

Michael J. Leaver

unread,
Feb 14, 2008, 7:04:45 AM2/14/08
to

Perfect, thanks.

0 new messages