Global It Leader!!



 
 

VB 윈도우7에서 Sendkey 사용하기

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 4,537회 작성일 15-02-17 16:15

본문

 
준비사항 : Form1, Text1, Text2, Text3, Text4
 
 
 
Option Explicit
Dim WshShell As Object
 
Private Sub Form_Load()
    Set WshShell = CreateObject("WScript.Shell")
End Sub
 
Private Sub Form_Unload(Cancel As Integer)
    Set WshShell = Nothing
End Sub
 
Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
        WshShell.SendKeys "{Tab}"
    End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
        WshShell.SendKeys "{Tab}"
    End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
        WshShell.SendKeys "{Tab}"
    End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
        WshShell.SendKeys "{Tab}"
    End If
End Sub
 
 
 
///////////////////////// 다른방법 : API사용 /////////////////////////
Option Explicit
Private Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
        Putfocus Text2.hwnd
    End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
        Putfocus Text3.hwnd
    End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
        Putfocus Text4.hwnd
    End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
        Putfocus Text1.hwnd
    End If
End Sub

댓글목록

등록된 댓글이 없습니다.

전체 95
게시물 검색
컴퓨터언어 목록
번호 제목 글쓴이 조회 날짜
95 VB no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 862 09-03
94 VB no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1202 09-03
93 VB no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1328 08-21
92 VB no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1671 07-20
91 VB no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2272 07-20
90 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7270 01-05
89 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4826 12-27
88 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4313 09-30
87 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5015 09-29
86 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4115 09-28
85 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4905 09-02
84 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7743 08-09
83 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4307 06-21
82 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4144 06-16
81 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4547 06-07
80 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4414 04-27
79 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8820 04-08
78 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4221 04-07
77 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6051 04-07
76 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4176 02-16