获得Novell网络的用户名
|
下面的例子给出了通过调用Novell API来获取用户名的方法:
1.说明下面的外部函数: function ulong NWInitialize() library "NWInfo" function ulong NWGetInfo( Long Drv, Long info, ref string buffer ) Library "NWInfo" 2.然后定义一个函数并加入下面的程序 // 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 |