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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get NT user id.

Status
Not open for further replies.

kmsam2

Programmer
May 21, 2003
29
MY
I'm using PB6 to connect MS SQL Server with integrated security, that mean use NT authenticate to login to database.
In the application, how to get the NT login id for user?
any sample code? Because I need to create a audit trail table.

Thanks.

Sam.

Sam.
 
We use a 'logon' nvo which has the following local external function:

Function boolean GetUserNameA (ref string name, ref ulong len) library "ADVAPI32.DLL"


This function retrieves the username.

//user win32 getusername

string ls_temp
ulong lul_value
boolean lb_rc

lul_value = 255
ls_temp = space(255)
lb_rc = GetUserNameA(ls_temp, lul_value)
If lb_rc Then
as_name = ls_temp
Return 1
Else
Return -1
End If
 
Sorry, not familar with nvo,
how to code "Function boolean GetUserNameA (ref string name, ref ulong len) library "ADVAPI32.DLL"

into PB6?


Sam.
 
Open the nvo
In the menu bar, select
Declare > Local External Functions and paste
"Function boolean GetUserNameA (ref string name, ref ulong len) library "ADVAPI32.DLL"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top