Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve Current Windows Session ID

Status
Not open for further replies.

jbsys

Programmer
May 6, 2005
51
0
0
CA
Hi;
I am writing my first dll in C++ and using MS Visual C++6.0. I'm having trouble determining how I can retrieve a Windows Session ID for the current session. Can someone help to point me in the right direction or provide a code sample of how I can retreive this information? The session ID will be used to assist in creating a unique filename.

Thanks.

jbsys
 
DWORD GetCurrentProcessId();
But:
MSDN said:
Until the process terminates, the process identifier uniquely identifies the process throughout the system.
...
The unique ID of this process. Process ID numbers are reused, so they identify a process only for the lifetime of that process.
So be careful: it's not an unique value if your process started, finished then started again...
 
Thanks - I'll certainly test and utilize this.

jbsys.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top