vb6.0 api 获取和设置计算机名 获取 鼠标位置坐标
2013-05-20 21:55
429 查看
模块中的声明:
Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Declare Function SetComputerName Lib "kernel32" Alias "SetComputerNameA" (ByVal lpComputerName As String) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As pointapi) As Long
Type pointapi
x As Long
y As Long
End Type
窗体中的代码:
Private Sub Command1_Click() '获取computer name
Dim name As String * 255, length As Long
length = 255
name = String(length, 0)
GetComputerName name, length
name = Left(name, InStr(name, Chr(0)) - 1)
Label1.Caption = name
End Sub
Private Sub Command2_Click() '设置computer name
Dim name As String
name = Text1.Text
SetComputerName name
End Sub
Private Sub Timer1_Timer() '随时获得鼠标坐标
Dim point As pointapi
GetCursorPos point
Label1.Caption = "x=" & point.x & "y=" & point.y
End Sub
Timer1.Interval=10
Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Declare Function SetComputerName Lib "kernel32" Alias "SetComputerNameA" (ByVal lpComputerName As String) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As pointapi) As Long
Type pointapi
x As Long
y As Long
End Type
窗体中的代码:
Private Sub Command1_Click() '获取computer name
Dim name As String * 255, length As Long
length = 255
name = String(length, 0)
GetComputerName name, length
name = Left(name, InStr(name, Chr(0)) - 1)
Label1.Caption = name
End Sub
Private Sub Command2_Click() '设置computer name
Dim name As String
name = Text1.Text
SetComputerName name
End Sub
Private Sub Timer1_Timer() '随时获得鼠标坐标
Dim point As pointapi
GetCursorPos point
Label1.Caption = "x=" & point.x & "y=" & point.y
End Sub
Timer1.Interval=10
相关文章推荐
- js获取鼠标坐标,设置div的高度、位置、内容等,及注意要点
- JavaScript 获取鼠标点击位置坐标
- C#中如何获取鼠标的位置坐标
- [Mapbox GL]获取鼠标位置的坐标
- 获取鼠标的坐标位置
- Qt 背景透明、无边框标题栏、鼠标拖动、定时器、获取屏幕分辨率,设置初始位置
- C#获取和设置鼠标的坐标
- javascript获取鼠标当前位置坐标 详细出处参考:http://www.jb51.net/article/27204.htm
- JS获取鼠标的坐标和滚动条的位置
- 用javascript获取鼠标坐标位置
- WPF 中获取和设置鼠标位置
- HTML5 调用 GPSAPI 获取当前位置的坐标 显示在地图上(有包括百度地图与谷歌地图)
- 获取事件目标对象的位置坐标或者鼠标位置坐标(兼容IE和火狐)
- MFC 获取picture控件的鼠标点击坐标位置的方法
- 基于JavaScript实现 获取鼠标点击位置坐标的方法
- js 获取鼠标位置坐标
- delphi 获取鼠标当前位置的相对坐标
- 【JS温故知新】之——给力的鼠标坐标位置获取
- 获取事件目标对象的位置坐标或者鼠标位置坐标(兼容IE和火狐)
- 获取/设置input中的鼠标光标位置