社区
VB基础类
帖子详情
GetCursorPos Lib "user32" 是API函数?
pallon
2004-09-15 10:05:07
Public Declare Function GetCursorPos Lib "user32" (LPPoint As POINTAPI) As Long
运行程序时停在这行代码上,是什么问题?开发是在98下开发的代码,现在在2000中打开就停在这行上,应该怎么解决?谢谢
...全文
321
5
打赏
收藏
GetCursorPos Lib "user32" 是API函数?
Public Declare Function GetCursorPos Lib "user32" (LPPoint As POINTAPI) As Long 运行程序时停在这行代码上,是什么问题?开发是在98下开发的代码,现在在2000中打开就停在这行上,应该怎么解决?谢谢
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
pallon
2004-09-16
打赏
举报
回复
to BlueBeer(1win) :
我在98上运行没提示错误,在XP下就不行,是不是这个是98下的API函数?如果我要改在2000或XP下可以运行该怎么搞呢?
BlueBeer
2004-09-15
打赏
举报
回复
【函数】
GetCursorPos
【操作系统】
Win9X:Yes
WinNT:Yes
【声明】
GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
【说明】
获取鼠标指针的当前位置
【返回值】
Long,非零表示成功,零表示失败。会设置GetLastError
【其它】
【参数表】
lpPoint -------- POINTAPI,随同指针在屏幕像素坐标中的位置载入的一个结构
helanshan
2004-09-15
打赏
举报
回复
函数没有问题,出错提示是什么啊。。。
online
2004-09-15
打赏
举报
回复
Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Rec As RECT, Point As POINTAPI
GetCursorPos Point
Debug.Print Point.X
Debug.Print Point.Y
End Sub
online
2004-09-15
打赏
举报
回复
Private Declare Function GetCursorPos Lib "user32.dll" (ByRef lpPoint As POINTAPI) As Long
[VB] 游戏中 热键 发消息 源码
Attribute VB_Name = "mdl_Hot_Key"
'\__________________________________________________________________________________
' SetHotkey 1, "Ctrl,112", "Add" '按 Ctrl F1 激活指定程序
' SetHotkey 2, 113, "Add" '按 F2 激活指定程序
' SetHotkey 3, "Ctrl Alt,113", "Add" '按 Ctrl Alt F2 激活指定程序
'注释:注:关于激活热键后的操作,由自定义
函数
SetHotkey 的 KeyId 传送的值来判断
'注销 3 个热键:
' SetHotkey 1, "", "Del" '退出程序是一定要用上的,不然会导至程序死掉
' SetHotkey 2, "", "Del"
' SetHotkey 3, "", "Del"
'请大家新建一个模块(.bas)文件,自定义 SetHotkey
函数
及其他,这样在以后的任何程序中只要调用此模块就可以了。
'注释: 本模块是有关热键操作的
'\____________________________________________________________________________________
Option Explicit
Private Declare Function SetWindowLong
Lib
"
user
32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong
Lib
"
user
32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function CallWindowProc
Lib
"
user
32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function RegisterHotKey
Lib
"
user
32" (ByVal hwnd As Long, ByVal id As Long, ByVal fskey_Modifiers As Long, ByVal vk As Long) As Long
Private Declare Function UnregisterHotKey
Lib
"
user
32" (ByVal hwnd As Long, ByVal id As Long) As Long
Public Declare Function GetWindow
Lib
"
user
32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function EnableWindow
Lib
"
user
32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
'Public Declare Function GetWindowRgn
Lib
"
user
32" (ByVal hwnd As Long, ByVal hRgn As Long) As Long
Private Declare Function GetWindowRect
Lib
"
user
32" (ByVal hwnd As Long, lpRect As RECT) As Long '|取得控件的在屏幕中的位置
Private Declare Function EnumChildWindows
Lib
"
user
32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long '|枚举子控件
Private Declare Function
GetCursorPos
Lib
"
user
32" (lpPoint As POINT
API
) As Long
Private Declare Function SetCursorPos
Lib
"
user
32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function WindowFromPoint
Lib
"
user
32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetForegroundWindow
Lib
"
user
32" () As Long '|// 获得当前活动窗体句柄
Public Declare Function GetWindowText
Lib
"
user
32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function SetWindowText
Lib
"
user
32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Public Declare Function GetWindowTextLength
Lib
"
user
32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Declare Function GetDesktopWindow
Lib
"
user
32" () As Long
Public Declare Function IsWindow
Lib
"
user
32" (ByVal hwnd As Long) As Long
Public Declare Function IsWindowVisible
Lib
"
user
32" (ByVal hwnd As Long) As Long
Public Declare Function SetWindowPos
Lib
"
user
32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Declare Function SendMessage
Lib
"
user
32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Sub keybd_event
Lib
"
user
32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Declare Sub Mouse_Event
Lib
"
user
32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
' // 鼠标动作标识 // 鼠标水平方向位置 // 鼠标垂直方向位置 // 鼠标轮子转动的数量 // 一个关联鼠标动作辅加信息
Const WM_HOTKEY =
vb用户定义类型未定义: Public Declare Function
GetCursorPos
Lib
"
user
32" (lpPoint As POINT
API
) As Long ;
回答者:VB妮可 - 总监 九级 11-7 16:14呵呵..给你个全部的例子你就知道了.. 使用了一个timer Private Declare Function
GetCursorPos
Lib
"
user
32" (lpPoint As POINT
API
) As Long Private Type POINT
API
主要是漏了这个 x A
鼠标
API
函数
(windows)
鼠标
API
函数
(win) 得到当前鼠标指针的坐标:
GetCursorPos
函数
声明: public Type POINT
API
x As Long y As Long End Type Public Declare Function
GetCursorPos
Lib
"
user
32" _ (lpPoint As POINT
API
) As Long 参数缺省为byref指针传
EXCEL实时获取鼠标坐标(稳定)
先添加类模块,命名为 MousePosition MousePosition类模块代码: Option Explicit Private Declare PtrSafe Function
GetCursorPos
Lib
"
user
32" (lpPoint As POINT
API
) As Long Private Declare PtrSafe Function GetInputState
Lib
"
user
32" () As Long Public WithEvents iApp As ..
VB6 Win32
API
函数
声明
""""""""""""""""""""""""""""""""""""""""""""""""""""""" ■■■■Win32
API
函数
声明■■■■ """"""""""""""""""""""""""""""""""""""""""""""""""""""" Declare Function AbortDoc
Lib
"gdi32" (ByVal hdc As Long) As...
VB基础类
7,765
社区成员
197,605
社区内容
发帖
与我相关
我的任务
VB基础类
VB 基础类
复制链接
扫一扫
分享
社区描述
VB 基础类
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章