Getting the Novell Username
This tip was submitted by Ashley Levin.

The following code shows how to access the Novell API and get the usename.

Declare the following external functions:

function ulong NWInitialize() library "NWInfo"
function ulong NWGetInfo( Long Drv, Long info, ref string buffer ) Library "NWInfo"

Then declare a function and add the following code:

// i_sys=1 - novell
string login_name
string ls_temp
integer drv,info
long l_ret

login_name = "user_name_error"

if i_sys = 1 then   // novell login name.
	l_ret = NWInitialize()    // init the dll, check for client 32 ...
	if l_ret  = 0  then
		drv = 7 // network drive g:
		info = 35 // typeless user name 
		ls_temp = Space( 129 )
		//  get the login name for specific drive
		l_ret = NWGetInfo( drv, info, ls_temp )
		if l_ret = 0 then
			login_name = Trim( ls_temp )
		end if
	end if			
end if

return login_name
Back