Decal Development Forums Forum Index Decal Development Forums
www.decaldev.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

VB 6.0 - SendKeys API

 
Post new topic   Reply to topic    Decal Development Forums Forum Index -> AC FAQ's and Howtos (Archive)
View previous topic :: View next topic  
Author Message
Zyrca



Joined: 19 Apr 2002
Posts: 219
Location: MA

PostPosted: Tue Jun 17, 2003 8:42 am    Post subject: VB 6.0 - SendKeys API Reply with quote

Put this code in a class:

Code:
Option Explicit

Private Declare Function SendMessage? Lib "user32" Alias "SendMessageA" (ByVal HWND As Long, ByVal? wMsg As Long, ByVal? wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow? Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal? lpWindowName As String) As Long
Private Const GWL_STYLE = (-16)

Private acHWND As Long

Private Const WM_LBUTTONUP = &H202
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_RBUTTONDOWN = &H204
Private Const WM_RBUTTONUP = &H205
Private Const WM_RBUTTONDBLCLK = &H206
Private Const WM_CAPTURECHANGED = &H215
Private Const WM_SYSCOMMAND = &H112
Private Const WM_SETFOCUS = &H7
Private Const WM_KILLFOCUS = &H8
Private Const WM_PASTE = &H302
Private Const WM_KEYDOWN = &H100
Private Const WM_CHAR = &H102
Private Const WM_KEYUP = &H101
Private Const WM_NOTIFY& = &H4E
Private Const WS_DISABLED = &H8000000
Private Const MOUSE_MOVE = &HF012
Private Const BM_SETSTATE = &HF3
Private Const BM_GETSTATE = &HF2
Private Const LB_SETCURSEL = &H186
Private Const LB_GETCURSEL = &H188
Private Const LVM_GETSELECTEDCOUNT = &H1032
Private Const LVM_GETSELECTIONMARK = &H1042 'Win32 and IE 4 only
Private Const LVM_SETSELECTIONMARK = &H1043 'Win32 and IE 4 only
Private Const LVM_SETITEMSTATE = &H102B&
Private Const LVIS_SELECTED = &H2
Private Const LVIF_STATE = &H8

Private Type LV_ITEM
   mask As Long
   iItem As Long
   iSubItem As Long
   state As Long
   stateMask As Long
   pszText As String
   cchTextMax As Long
   iImage As Long
   lParam As Long
   iIndent As Long
End Type

Private Type NMHDR
   hwndFrom As Long        ' Window handle of control sending message
   idFrom As Long               ' Identifier of control sending message
   code As Long                  ' Specifies the notification code
End Type

Private heartbeat As Long
Private timer As Long
Private threeStrikes As Integer

Private acWin As Long
Private acWinCur As Long
Private btnHwnd As Long
Private btnHwndCur As Long
Private dlgHwnd As Long
Private txtHwnd As Long

Private command As String
Private flash As Boolean
Private pass As String

'user defined type required by Shell_NotifyIcon? API call
Private Type NOTIFYICONDATA
 cbSize As Long
 HWND As Long
 uId As Long
 uFlags As Long
 uCallBackMessage As Long
 hIcon As Long
 szTip As String * 64
End Type

'constants required by Shell_NotifyIcon? API call:
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4

Private Const WM_MOUSEMOVE = &H200

Private Declare Function SetForegroundWindow? Lib "user32" (ByVal HWND As Long) As Long
Private nid As NOTIFYICONDATA

Public Sub PressKey(keyVK As Long)
   Call SendMessage(acHWND, WM_KEYDOWN, keyVK, 1)
   Call SendMessage(acHWND, WM_KEYUP, keyVK, 1)
End Sub


Private Sub Class_Initialize()
   acHWND = FindWindow("Asheron's Call", "Asheron's Call")
End Sub

_________________
-Zyrca
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Decal Development Forums Forum Index -> AC FAQ's and Howtos (Archive) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group