插入符:
GetCaretPos
The GetCaretPos function copies the caret's position, in client coordinates, to the specifiedPOINT structure. BOOL GetCaretPos(
LPPOINT lpPoint // address of structure to receive coordinates
);鼠标:
GetCursorPos
The GetCursorPos function retrieves the cursor's position, in screen coordinates. BOOL GetCursorPos(
LPPOINT lpPoint // address of structure for cursor position
);
Parameters
GetCaretPos
The GetCaretPos function copies the caret's position, in client coordinates, to the specifiedPOINT structure. BOOL GetCaretPos(
LPPOINT lpPoint // address of structure to receive coordinates
);鼠标:
GetCursorPos
The GetCursorPos function retrieves the cursor's position, in screen coordinates. BOOL GetCursorPos(
LPPOINT lpPoint // address of structure for cursor position
);
Parameters
解决方案 »
- "[^.0-9\r]{1,}"涉及到的正则法知识点?
- 求助:关于用VB写EXCEL中的插入批注代码遇到问题(100分)
- vb哪里有第三方控件下载?
- 关于由用户自定义报表的问题,想问一下有经验的人
- 水晶报表的数据源问题
- 在线等,正确就给分,关于SQL2000的问题??
- 用Installshield professional 6.2生成的安装文件,安装时出错!请大家帮助!
- 关于删除纪录问题!
- 请各位帮帮忙看看这个 问题。在线等
- 有谁见过专门识别数字的屏幕OCR软件没?只要识别数字别的不要,屏幕识别不是图片识别.多谢!!
- 如何读取EXCEL表中的内容?
- zyl910(910:如何获得键盘光标闪烁的X,Y位置,(不是当前鼠标的位置)?
Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
说明
获取鼠标指针的当前位置
返回值
Long,非零表示成功,零表示失败。会设置GetLastError
参数表
参数 类型及说明
lpPoint POINTAPI,随同指针在屏幕像素坐标中的位置载入的一个结构
'This project needs
'a Form, called 'Form1'
'a Picture Box, called 'ExplButton' (50x50 pixels)
'a Picture Box with an icon in it, called 'picIcon'
'two timers (Timer1 and Timer2), both with interval 100
'Button, called 'Command1'
'In general section
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'Declare the API-Functions
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 GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Sub DrawButton(Pushed As Boolean)
Dim Clr1 As Long, Clr2 As Long
If Pushed = True Then
'If Pushed=True then clr1=Dark Gray
Clr1 = &H808080
'If Pushed=True then clr1=White
Clr2 = &HFFFFFF
ElseIf Pushed = False Then
'If Pushed=True then clr1=White
Clr1 = &HFFFFFF
'If Pushed=True then clr1=Dark Gray
Clr2 = &H808080
End If With Form1.ExplButton
' Draw the button
Form1.ExplButton.Line (0, 0)-(.ScaleWidth, 0), Clr1
Form1.ExplButton.Line (0, 0)-(0, .ScaleHeight), Clr1
Form1.ExplButton.Line (.ScaleWidth - 1, .ScaleHeight - 1)-(.ScaleWidth - 1, 0), Clr2
Form1.ExplButton.Line (.ScaleWidth - 1, .ScaleHeight - 1)-(0, .ScaleHeight - 1), Clr2
End With
End Sub
Private Sub Command1_Click()
Dim Rec As RECT
'Get Left, Right, Top and Bottom of Form1
GetWindowRect Form1.hwnd, Rec
'Set Cursor position on X
SetCursorPos Rec.Right - 15, Rec.Top + 15
End Sub
Private Sub ExplButton_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawButton True
End Sub
Private Sub ExplButton_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawButton False
End Sub
Private Sub ExplButton_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawButton False
End Sub
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: [email protected] Dim Stretched As Boolean
'picIcon.Visible = False
'API uses pixels
picIcon.ScaleMode = vbPixels
'No border
ExplButton.BorderStyle = 0
'API uses pixels
ExplButton.ScaleMode = vbPixels
'Set graphic mode te 'persistent graphic'
ExplButton.AutoRedraw = True
'API uses pixels
Me.ScaleMode = vbPixels
'Set the button's caption
Command1.Caption = "Set Mousecursor on X" ' If you set Stretched to true then stretch the icon to te Height and Width of the button
' If Stretched=False, the icon will be centered
Stretched = False If Stretched = True Then
' Stretch the Icon
ExplButton.PaintPicture picIcon.Picture, 1, 1, ExplButton.ScaleWidth - 2, ExplButton.ScaleHeight - 2
ElseIf Stretched = False Then
' Center the picture of the icon
ExplButton.PaintPicture picIcon.Picture, (ExplButton.ScaleWidth - picIcon.ScaleWidth) / 2, (ExplButton.ScaleHeight - picIcon.ScaleHeight) / 2
End If
' Set icon as picture
ExplButton.Picture = ExplButton.Image
End Sub
Private Sub Timer1_Timer()
Dim Rec As RECT, Point As POINTAPI
' Get Left, Right, Top and Bottom of Form1
GetWindowRect Me.hwnd, Rec
' Get the position of the cursor
GetCursorPos Point ' If the cursor is located above the form then
If Point.X >= Rec.Left And Point.X <= Rec.Right And Point.Y >= Rec.Top And Point.Y <= Rec.Bottom Then
Me.Caption = "MouseCursor is on form."
Else
' The cursor is not located above the form
Me.Caption = "MouseCursor is not on form."
End If
End Sub
Private Sub Timer2_Timer()
Dim Rec As RECT, Point As POINTAPI
' Get Left, Right, Top and Bottom of ExplButton
GetWindowRect ExplButton.hwnd, Rec
' Get the position of the cursor
GetCursorPos Point
' If the cursor isn't located above ExplButton then
If Point.X < Rec.Left Or Point.X > Rec.Right Or Point.Y < Rec.Top Or Point.Y > Rec.Bottom Then ExplButton.Cls
End Sub
你的第二个问题,
可以判断当字符为"."时,在这个们置出现一个list框或是窗体!
讲清楚一点!
Declare Function GetCharABCWidths Lib "gdi32" Alias "GetCharABCWidthsA" (ByVal hdc As Long, ByVal uFirstChar As Long, ByVal uLastChar As Long, lpabc As ABC) As Long说明
判断TureType字体中一个或多个字符的A-B-C大小返回值
Long,非零表示成功,零表示失败。会设置GetLastError参数表
参数 类型及说明
hdc ------------ Long,设备场景的句柄 uFirstChar ----- Long,欲调查A-B-C尺寸的第一个字符的ASCII值 uLastChar ------ Long,欲调查A-B-C尺寸的最后一个字符的ASCII值 lpabc ---------- ABC,在ABC结构数组中的第一个条目。这个数组填充了指定的字符大小设置。该数组的长度必须足够大,足以容下要求的所有字符对于非TureType字体用GetCharWidth函数
贴错了
那是FoxAPI的Bug
Win9X:Yes
WinNT:Yes
【说明】
判断插入符的当前位置
【返回值】
Long,非零表示成功,零表示失败。会设置GetLastError
【其它】
【参数表】
lpPoint -------- POINTAPI,这个结构会随同插入符在窗口客户坐标系统中的位置载入;那个窗口是插入符的父窗口