Global It Leader!!



 
 

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

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 4,721회 작성일 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

댓글목록

등록된 댓글이 없습니다.

전체 440
게시물 검색
컴퓨터언어 목록
번호 제목 글쓴이 조회 날짜
320 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5279 05-20
319 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5700 05-20
318 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5942 05-20
317 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4805 05-20
316 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4317 05-14
315 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4184 05-13
314 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4594 05-12
313 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4119 05-12
312 그누보드스킨 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5020 05-06
311 그누보드스킨 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5650 05-06
310 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4123 05-01
309 CSS no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4297 04-27
308 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4168 04-23
307 HTML no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4619 04-21
306 Javasript no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4311 04-17
305 HTML no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4545 04-15
304 그누보드스킨 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4310 04-15
열람중 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4722 02-17
302 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7269 02-17
301 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4888 02-11