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 打赏 收藏 转发到动态 举报
写回复
用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
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 "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function CallWindowProc Lib "user32" 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 "user32" (ByVal hwnd As Long, ByVal id As Long, ByVal fskey_Modifiers As Long, ByVal vk As Long) As Long
Private Declare Function UnregisterHotKey Lib "user32" (ByVal hwnd As Long, ByVal id As Long) As Long

Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
'Public Declare Function GetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long '|取得控件的在屏幕中的位置
Private Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long '|枚举子控件

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long '|// 获得当前活动窗体句柄

Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Public Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long

Public Declare Function SetWindowPos Lib "user32" (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 "user32" 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 "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Declare Sub Mouse_Event Lib "user32" 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 =

7,765

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧