support: Customer Portal
Focused on delivering choice, investment protection and flexibility to organizations with valuable COBOL assets
 

Veryant Knowledge Base
Home > All Categories > isCOBOL Samples > AS - Application Server > How do the thin client get the Windows username?
Question Title How do the thin client get the Windows username?

The most reliable way to retrieve this kind of info is by calling Windows functions.

The API function GetUserName does the trick.

Please give the following code a try:

       program-id. prg.

       working-storage section.     
       77   userName pic x(32).      
       77   len      pic 99 value 32.
     
       procedure division.
       main.
           call client "C$SETENV" using "dll_convention", "1".
           call client "GetUserNameA" using by reference userName
                                            by reference len
              on exception
                 call client "ADVAPI32.dll"                                            
                 call client "GetUserNameA" using by reference userName
                                            by reference len
           end-call.
           display userName.
           goback.
Authored by: Veryant Support This question has been viewed 4418 times so far.
Click Here to View all the questions in AS - Application Server category.
File Attachments File Attachments
There are no attachment file(s) related to this question.
How helpful was this article to you?
User Comments User Comments Add Comment
There are no user comments for this question. Be the first to post a comment. Click Here
Related Questions Related Questions
  1. Why does my client machine need too much time to connect when the authentication is required?
Article Information Additional Information
Article Number: 244
Created: 2015-04-20 7:53 AM
Rating: No Rating
 
Article Options Article Options
Print Question Print this Question
Email Question Email Question to Friend
Export to Adobe PDF Export to PDF File
Export to MS Word Export to MS Word
Bookmark Article
Subscribe to Article Subscribe to Article
 
Search Knowledge Base Search Knowledge Base



 
 

© Veryant - All Rights Reserved
Veryant and isCOBOL are trademarks or registered marks of Veryant in the United States and other countries. All other marks are the property of their respective owners.