开发者

Where to find a unique session ID at design time in .Net WinForms

I've created a custom clipboard because it's not possible to make my whole class map serializable - which is a requirement for the windows clipboard.

However, I need to distinguish between users who are using my clipboard through a unique id. Basically, I want to be able identify a person who is sat at one PC with one or more copies of visual studio (or similar) open.

How do I do that?

ps: This is at design-time.

pps: It's not critical that it should work between copies of visual studio. One copy would be fine, or even one desig开发者_开发技巧n surface.


You can combine the USERNAME and SESSIONNAME environmental variables. This should give you a unique ID per logged on session.

You need to combine them in case you have two people logged into the console, whereas the SESSIONNAME would be "Console" for both users.

In order to distinguish Visual Studios you could append the process id of VS as well.

If only VS is in question, then the process id should be enough in itself, since two users can't share a process.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜