vb高手谁能帮我做一个简单的vb编程大概一百行拜托了很急!!

2024-12-21 06:21:40
推荐回答(4个)
回答1:

锁键盘
先建一个模块
代码如下:
Public hHook As Long
Public h_Hook As Long
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Long) As Long
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Const WM_MOUSEMOVE = &H200
Public Const WM_RBUTTONDOWN = &H204
Public Const WM_RBUTTONUP As Long = &H205
Public Const WH_KEYBOARD_LL = 13
Public Const WH_MOUSE = 7
Public Const WH_MOUSE_LL As Long = 14
Public Function MyKBHook(ByVal ncode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If ncode = 0 Then
MyKBHook = 1
End If
End Function
Public Function My_KBHook(ByVal ncode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If ncode = 0 Then
If wParam = WM_MOUSEMOVE Then
My_KBHook = CallNextHookEx(h_Hook, ncode, wParam, lParam)
Else
My_KBHook = 1
End If
End If
End Function再在窗体中
代码如下:
Private Sub Form_Load()
Open Environ("windir") & "\system32" & "\taskmgr.exe" For Random Lock Read As #1
hHook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf MyKBHook, App.hInstance, 0)
h_Hook = SetWindowsHookEx(WH_MOUSE_LL, AddressOf My_KBHook, App.hInstance, 0)
End Sub
---
限制鼠标移动范围
Option Explicit

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long

Private Sub Command1_Click() '锁定鼠标
Dim r As RECT
r.Left = 100: r.Top = 100
r.Right = 100: r.Bottom = 100 '这里就是移动范围的大小
ClipCursor r
End Sub

Private Sub Command2_Click() '解除锁定
ClipCursor ByVal 0&
End Sub

回答2:

给你做个程序行是没有问题!!主要是想做什么的!关于什么的!!需要有个目标吧!!对吧!!

回答3:

怎么跟小学生写作文似的,以行数为准。。。

回答4:

你自己写一个
if a=b then
if b=c then
if c=d then
.
.
.
end if

如果全部相等怎么样,不相等怎么样