A bit more information may be needed!
Like operating system details
On the face of it maybe the GetUserNameEx api call may do what you require, but it is only available for Windows 2000 or XP.
Take Care
Matt
If at first you don't succeed, skydiving is not for you.