SendKeys "{HOME}" และ SendKeys "{END}" บนฟิลด์ Text


0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

04 ม.ค. 66 , 15:18:30
อ่าน 293 ครั้ง

nonc31

SendKeys "{HOME}" และ SendKeys "{END}" บนฟิลด์ Text
« เมื่อ: 04 ม.ค. 66 , 15:18:30 »
เหมือนจะง่าย  แต่กว่าจะเข้าใจ  นำมาฝากครับ  วินโดว์ 7 ขึ้นมา ใช้ SendKeys "{HOME}" และ  SendKeys "{END}" ไม่ได้แล้ว

Option Compare Database

#If Win64 Or VBA7 Then
    Private Declare PtrSafe Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    Private Declare PtrSafe Function GetKeyState Lib "user32.dll" (ByVal nVirtKey As Long) As Integer
#Else
    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    Private Declare Function GetKeyState Lib "user32.dll" (ByVal nVirtKey As Long) As Integer
#End If

    Private Const VK_HOME = &H24
    Private Const VK_END = &H23
    Private Const VK_F2 = &H71
   
Private Sub Command2_Click() 'SendKeys HOME
    Me.Text0.SetFocus
    keybd_event VK_F2, 1, 0, 0
    keybd_event VK_F2, 1, KEYEVENTF_KEYUP, 0
    keybd_event VK_HOME, 1, 0, 0
    keybd_event VK_HOME, 1, KEYEVENTF_KEYUP, 0
End Sub

Private Sub Command3_Click() 'SendKeys END ใช้ F2 แทน
    Me.Text0.SetFocus
    keybd_event VK_F2, 1, 0, 0
    keybd_event VK_F2, 1, KEYEVENTF_KEYUP, 0
End Sub

 
โพสต์นี้ได้รับคำขอบคุณจาก: UnKnown, Un


บอร์ดเรียนรู้ Access สำหรับคนไทย



There are no comments for this topic. Do you want to be the first?
 

Sitemap 1 2 3 4 5