views:

92

answers:

1

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 design surface.

+1  A: 

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.

Mikael Svenson