开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 3329|回复: 14
收起左侧

[其它求助] 【VB】求翻译。。

[复制链接]

结帖率:100% (6/6)
发表于 2011-11-27 14:27:13 | 显示全部楼层 |阅读模式   重庆市重庆市
本帖最后由 易团俊 于 2011-11-27 14:29 编辑

http://support.microsoft.com/kb/113945

谁能翻译成易语言。。有赏。。

回答提醒:如果本帖被关闭无法回复,您有更好的答案帮助楼主解决,请发表至 源码区 可获得加分喔。
友情提醒:本版被采纳的主题可在 申请荣誉值 页面申请荣誉值,获得 1点 荣誉值,荣誉值可兑换荣誉会员、终身vip用户组。
快捷通道:申请荣誉值无答案申请取消悬赏投诉有答案未采纳为最佳

结帖率:33% (1/3)

签到天数: 1 天

发表于 2011-11-27 14:31:03 | 显示全部楼层   上海市上海市
版主也有不会 的·····  罕见····  看看·
回复 支持 反对

使用道具 举报

结帖率:33% (1/3)

签到天数: 1 天

发表于 2011-11-27 14:33:30 | 显示全部楼层   上海市上海市
用API函数  netuserenum()
列:
Example Name: Enumerating the User List and Obtaining User Info

'------------------------------------------------------------------------------
'
' Form Code
'
'------------------------------------------------------------------------------

Option Explicit

'Windows type used to call the Net API
Private Type USER_INFO_10
   usr10_name          As Long
   usr10_comment       As Long
   usr10_usr_comment   As Long
   usr10_full_name     As Long
End Type

'private type to hold the actual strings displayed
Private Type USER_INFO
   name          As String
   full_name     As String
   comment       As String
   usr_comment   As String
End Type

Private Const ERROR_SUCCESS As Long = 0&
Private Const MAX_COMPUTERNAME As Long = 15
Private Const MAX_USERNAME As Long = 256
Private Const FILTER_NORMAL_ACCOUNT  As Long = &H2

Private Declare Function NetUserGetInfo Lib "netapi32" _
   (lpServer As Byte, _
   username As Byte, _
   ByVal level As Long, _
   lpBuffer As Long) As Long
   
Private Declare Function NetUserEnum Lib "netapi32" _
  (servername As Byte, _
   ByVal level As Long, _
   ByVal filter As Long, _
   buff As Long, _
   ByVal buffsize As Long, _
   entriesread As Long, _
   totalentries As Long, _
   resumehandle As Long) As Long
   
Private Declare Function NetApiBufferFree Lib "netapi32" _
  (ByVal Buffer As Long) As Long

Private Declare Function GetUserName Lib "advapi32" _
   Alias "GetUserNameA" _
  (ByVal lpBuffer As String, _
   nSize As Long) As Long
   
Private Declare Function GetComputerName Lib "kernel32" _
   Alias "GetComputerNameA" _
  (ByVal lpBuffer As String, _
   nSize As Long) As Long

Private Declare Sub CopyMemory Lib "kernel32" _
   Alias "RtlMoveMemory" _
  (xDest As Any, _
   xSource As Any, _
   ByVal nBytes As Long)

Private Declare Function lstrlenW Lib "kernel32" _
  (ByVal lpString As Long) As Long

Private Declare Function StrLen Lib "kernel32" _
   Alias "lstrlenW" _
  (ByVal lpString As Long) As Long


Private Sub Form_Load()

   Dim tmp As String
   Dim bServername() As Byte
   
   tmp = rgbGetComputerName()

  'assure the server string is properly formatted
   If Len(tmp) Then
   
      If InStr(tmp, "\\") Then
            bServername = tmp & Chr$(0)
      Else: bServername = "\\" & tmp & Chr$(0)
      End If
   
   End If
   
   Text1.Text = tmp

   Call GetUserEnumInfo(bServername())
   
End Sub


Private Function GetUserEnumInfo(bServername() As Byte)
  
   Dim users() As Long
   Dim buff As Long
   Dim buffsize As Long
   Dim entriesread As Long
   Dim totalentries As Long
   Dim cnt As Integer
   
   buffsize = 255
   
   If NetUserEnum(bServername(0), 0, _
                   FILTER_NORMAL_ACCOUNT, _
                   buff, buffsize, _
                   entriesread, _
                   totalentries, 0&) = ERROR_SUCCESS Then
   
      ReDim users(0 To entriesread - 1) As Long
      CopyMemory users(0), ByVal buff, entriesread * 4
      
      For cnt = 0 To entriesread - 1
         List1.AddItem GetPointerToByteStringW(users(cnt))
      Next cnt
      
      NetApiBufferFree buff
   
   End If

End Function


Private Function rgbGetComputerName() As String

  'returns the name of the computer
   Dim tmp As String
   
   tmp = Space$(MAX_COMPUTERNAME + 1)
   
   If GetComputerName(tmp, Len(tmp)) <> 0 Then
      rgbGetComputerName = TrimNull(tmp)
   End If
   
End Function


Private Function TrimNull(item As String)

   Dim pos As Integer
   
   pos = InStr(item, Chr$(0))
   
   If pos Then
         TrimNull = Left$(item, pos - 1)
   Else: TrimNull = item
   End If
   
End Function


Private Function GetUserNetworkInfo(bServername() As Byte, bUsername() As Byte) As USER_INFO
   
   Dim usrapi As USER_INFO_10
   Dim buff As Long
   
   If NetUserGetInfo(bServername(0), bUsername(0), 10, buff) = ERROR_SUCCESS Then
      
     'copy the data from buff into the
     'API user_10 structure
      CopyMemory usrapi, ByVal buff, Len(usrapi)
      
     'extract each member and return
     'as members of the UDT
      GetUserNetworkInfo.name = GetPointerToByteStringW(usrapi.usr10_name)
      GetUserNetworkInfo.full_name = GetPointerToByteStringW(usrapi.usr10_full_name)
      GetUserNetworkInfo.comment = GetPointerToByteStringW(usrapi.usr10_comment)
      GetUserNetworkInfo.usr_comment = GetPointerToByteStringW(usrapi.usr10_usr_comment)
   
      NetApiBufferFree buff
   
   End If
   
End Function


Private Function GetPointerToByteStringW(lpString As Long) As String
  
   Dim buff() As Byte
   Dim nSize As Long
   
   If lpString Then
   
     'its Unicode, so mult. by 2
      nSize = lstrlenW(lpString) * 2
      
      If nSize Then
         ReDim buff(0 To (nSize - 1)) As Byte
         CopyMemory buff(0), ByVal lpString, nSize
         GetPointerToByteStringW = buff
     End If
     
   End If
   
End Function


Private Sub List1_Click()

   Dim usr As USER_INFO
   Dim bUsername() As Byte
   Dim bServername() As Byte
   Dim tmp As String
  
  'This assures that both the server
  'and user params have data
   If Len(Text1.Text) And List1.ListIndex > -1 Then
   
      bUsername = List1.List(List1.ListIndex) & Chr$(0)
   
     'This demo uses the current machine as the
     'server param, which works on NT4 and Win2000.
     'If connected to a PDC or BDC, pass that
     'name as the server, instead of the return
     'value from GetComputerName().
      tmp = Text1.Text
   
     'assure the server string is properly formatted
      If Len(tmp) Then
      
         If InStr(tmp, "\\") Then
               bServername = tmp & Chr$(0)
         Else: bServername = "\\" & tmp & Chr$(0)
         End If
      
      End If

      usr = GetUserNetworkInfo(bServername(), bUsername())
      
      Text3.Text = usr.name
      
     'The call may or may not return the
     'full name, comment or usr_comment
     'members, depending on the user's
     'listing in User Manager.
      Text4.Text = usr.full_name
      Text5.Text = usr.comment
      Text6.Text = usr.usr_comment
   
   End If

End Sub

点评

看不懂   重庆市重庆市  发表于 2011-11-27 14:36
一长串的。。我看不到。。翻译成易语言。。   重庆市重庆市  发表于 2011-11-27 14:35
回复 支持 反对

使用道具 举报

结帖率:98% (98/100)

签到天数: 26 天

发表于 2011-11-27 14:37:27 | 显示全部楼层   河南省郑州市
西瓜大大 发表于 2011-11-27 14:33
用API函数  netuserenum()
列:
Example Name: Enumerating the User List and Obtaining User Info

看懂了1点。。
但是不知道控件是神魔         
回复 支持 反对

使用道具 举报

结帖率:33% (1/3)

签到天数: 1 天

发表于 2011-11-27 14:39:05 | 显示全部楼层   上海市上海市
我给个编译好的源码: Windows用户组名获取.rar (13.06 KB, 下载次数: 6)

点评

QQ上交谈   重庆市重庆市  发表于 2011-11-27 14:45
回复 支持 反对

使用道具 举报

结帖率:33% (1/3)

签到天数: 1 天

发表于 2011-11-27 14:46:37 | 显示全部楼层   上海市上海市
西瓜大大 发表于 2011-11-27 14:39
我给个编译好的源码:

QQ人满了··   1个月没上了·   还是论坛吧
回复 支持 反对

使用道具 举报

结帖率:100% (6/6)
 楼主| 发表于 2011-11-27 14:51:02 | 显示全部楼层   重庆市重庆市
西瓜大大 发表于 2011-11-27 14:46
QQ人满了··   1个月没上了·   还是论坛吧

木有模块的说。。
回复 支持 反对

使用道具 举报

结帖率:33% (1/3)

签到天数: 1 天

发表于 2011-11-27 14:53:19 | 显示全部楼层   上海市上海市
易团俊 发表于 2011-11-27 14:51
木有模块的说。。

不好意思,模块忘记放禁区了  我在发下模块! 啊哈.rar (32.11 KB, 下载次数: 2)
回复 支持 反对

使用道具 举报

结帖率:100% (6/6)
 楼主| 发表于 2011-11-27 14:59:12 | 显示全部楼层   重庆市重庆市
西瓜大大 发表于 2011-11-27 14:53
不好意思,模块忘记放禁区了  我在发下模块!

你确定是翻译的么。。。我的是取注册用户!

微软用户
微软中国。
回复 支持 反对

使用道具 举报

结帖率:33% (1/3)

签到天数: 1 天

发表于 2011-11-27 15:00:09 | 显示全部楼层   上海市上海市
易团俊 发表于 2011-11-27 14:59
你确定是翻译的么。。。我的是取注册用户!

微软用户

,我的是   取 WINDOWS 的账户··

点评

你到底会不会翻译。。。   重庆市重庆市  发表于 2011-11-27 15:05
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:wp@125.la
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表