我想做个VB程序,发送一个V键到CS游戏中执行,可CS老不接受,发到其它窗口就没问题用过
sendkeys "v"keybd_event "86", 0, 0, 0SendMessage GetForegroundWindow, &H102, 86, ByVal 0PostMessage GetForegroundWindow, &H100, 118, 0这些全都对游戏没效,但我试了连点器那些工具就可以,不知它是如果实现这个操作的请问高手有什么好的解决办法?
sendkeys "v"keybd_event "86", 0, 0, 0SendMessage GetForegroundWindow, &H102, 86, ByVal 0PostMessage GetForegroundWindow, &H100, 118, 0这些全都对游戏没效,但我试了连点器那些工具就可以,不知它是如果实现这个操作的请问高手有什么好的解决办法?
解决方案 »
- 求c/s模式网络下载程序的实例教学教程?
- VB里如何添加一个注册帐号按钮,可以直接在ACC数据库里注册帐号
- 如何打印七行的菱形?在线等!
- 怎样查看数据库中是不是已存在某条记录 ?
- 求助:在VB中如何判断一个OCX是否已经注册??
- 如何给ADODB.FIELD类型的数据赋值?!
- 怎样取得RECORDSET记录中特定某条记录?
- 在VB运行时出现的读内存错误,请援助!!
- 历史上最快的纯VB写的图像处理程序!其中640*480半透明合并速度只比Bitblt慢3倍,比AlphaBlend慢1倍!亮度淡入淡出演示,只比那个内嵌汇
- 给女朋友的问题。
- SQL Server里面是支持批插入和批更新的触发器的,为自己的无知向大家道歉,抛砖引玉,希望你能给出更好的代码~~(正文为测试脚本)
- 再请教dll问题!
keybd_event "86", 0, 0, 0
发送到其它游戏就没问题用
SendMessage GetForegroundWindow, &H102, 86, ByVal 0
发送到CMD窗口也能显示出来呀,我都是用GetForegroundWindow和Timer实时或Hotkey发送到当前窗口的,句柄应该不会有错奇怪就是用别人的连点器就能实现,真不知它怎搞的
keybd_event "86", 0, 0, 0
也不行?保持焦点了么?
也不行?保持焦点了么?在游戏画面中确是不行,但在其它一些选项设置中是有效的。
如下:导入, MSVCRT.dll
顺序 (示意) 名字
0000010C _initterm
00000058 __getmainargs
0000008D _acmdln
00000246 exit
00000082 __setusermatherr
0000009B _adjust_fdiv
00000048 _XcptFilter
00000069 __p__commode
000002E0 wcscpy
000001E7 _wcsicmp
0000025B free
0000028E malloc
0000006E __p__fmode
000000EE _ftol
000002AF sprintf
00000080 __set_app_type
000002C9 swscanf
000000C7 _except_handler3
000000B4 _controlfp
000000D0 _exit
000002E3 wcslen导入, KERNEL32.dll
顺序 (示意) 名字
0000019B GetWindowsDirectoryW
000001EC LocalFree
0000032A lstrcatW
00000130 GetLastError
00000333 lstrcpyW
0000010E GetCurrentThread
000000C6 FreeLibrary
00000156 GetProcAddress
000001E5 LoadLibraryW
0000001E CloseHandle
000001E8 LocalAlloc
00000330 lstrcmpiW
000002FE WaitForMultipleObjects
00000050 CreateThread
0000010F GetCurrentThreadId
0000020C OpenEventW
00000035 CreateEventW
00000293 SetEvent
00000044 CreateMutexW
0000029F SetLastError
000000DE GetCommandLineW
0000032D lstrcmpW
0000017B GetSystemWindowsDirectoryW
0000013C GetModuleFileNameW
0000008F ExitProcess
00000193 GetVersionExW
0000013D GetModuleHandleA
00000169 GetStartupInfoA
0000010C GetCurrentProcess
00000339 lstrlenW
000001E2 LoadLibraryA
导入, USER32.dll
顺序 (示意) 名字
000000F3 GetClientRect
00000090 DestroyWindow
0000017E InvalidateRect
00000033 CheckDlgButton
00000116 GetKeyboardLayout
00000166 GetWindowThreadProcessId
00000193 IsWindow
0000011B GetKeyboardType
000001F9 RegisterClassW
000001A1 LoadCursorW
000001A3 LoadIconW
000000ED GetClassInfoW
0000005B CreateWindowExW
00000149 GetSystemMetrics
00000260 SetWindowPos
0000015B GetWindowLongW
00000146 GetSysColor
00000225 SetClassLongW
0000025E SetWindowLongW
00000115 GetKeyState
000002B3 wsprintfA
000000AC DrawIconEx
00000261 SetWindowRgn
00000207 ReleaseDC
00000100 GetDC
000001BC MapVirtualKeyExW
0000027F ToUnicodeEx
0000003E CloseDesktop
00000153 GetUserObjectInformationW
000001DA OpenDesktopW
000001DC OpenInputDesktop
000001E4 PostMessageW
00000256 SetThreadDesktop
0000014D GetThreadDesktop
00000098 DispatchMessageW
00000287 TranslateMessage
00000131 GetMessageW
00000296 UpdateWindow
0000026F ShowWindow
00000205 RegisterWindowMessageW
00000206 ReleaseCapture
000000B9 EnableWindow
00000035 CheckMenuRadioItem
000000B7 EnableMenuItem
000001CA ModifyMenuW
00000034 CheckMenuItem
00000199 KillTimer
00000221 SetCapture
0000022A SetCursor
00000038 ChildWindowFromPointEx
000000FF GetCursorPos
00000234 SetForegroundWindow
000001E5 PostQuitMessage
00000190 IsIconic
000001CE MoveWindow
00000245 SetProcessWindowStation
000001DE OpenWindowStationW
0000013B GetProcessWindowStation
00000040 CloseWindowStation
00000102 GetDesktopWindow
00000004 AllowSetForegroundWindow
0000010B GetForegroundWindow
00000217 SendInput
00000000 ActivateKeyboardLayout
00000257 SetTimer
000001BD MapVirtualKeyW
000000E6 GetAsyncKeyState
000000DA FindWindowW
0000011F GetMenu
00000231 SetDlgItemTextW
000000B8 EnableScrollBar
00000108 GetDlgItemTextW
000002AE WinHelpW
000002B4 wsprintfW
0000021D SendMessageW
000000BB EndDialog
0000000C BeginPaint
00000160 GetWindowRect
0000020E ScreenToClient
000001A5 LoadImageW
000001B0 LoadStringW
000001C8 MessageBoxW
00000087 DefWindowProcW
00000096 DialogBoxParamW
000000BD EndPaint
00000105 GetDlgItem
高手快看看,它是调用那个函数模拟按键的
Const VK_E = 69
Const VK_L = 76
Const VK_O = 79
Const KEYEVENTF_KEYUP = &H2
Const INPUT_MOUSE = 0
Const INPUT_KEYBOARD = 1
Const INPUT_HARDWARE = 2
Private Type MOUSEINPUT
dx As Long
dy As Long
mouseData As Long
dwFlags As Long
time As Long
dwExtraInfo As Long
End Type
Private Type KEYBDINPUT
wVk As Integer
wScan As Integer
dwFlags As Long
time As Long
dwExtraInfo As Long
End Type
Private Type HARDWAREINPUT
uMsg As Long
wParamL As Integer
wParamH As Integer
End Type
Private Type GENERALINPUT
dwType As Long
xi(0 To 23) As Byte
End Type
Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Long, pInputs As GENERALINPUT, ByVal cbSize As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Private Sub Form_KeyPress(KeyAscii As Integer)
'Print the key on the form
Me.Print Chr$(KeyAscii);
End Sub
Private Sub Form_Paint()
'Clear the form
Me.Cls
'call the SendKey-function
SendKey VK_H
SendKey VK_E
SendKey VK_L
SendKey VK_L
SendKey VK_O
End Sub
Private Sub SendKey(bKey As Byte)
Dim GInput(0 To 1) As GENERALINPUT
Dim KInput As KEYBDINPUT
KInput.wVk = bKey 'the key we're going to press
KInput.dwFlags = 0 'press the key
'copy the structure into the input array's buffer.
GInput(0).dwType = INPUT_KEYBOARD ' keyboard input
CopyMemory GInput(0).xi(0), KInput, Len(KInput)
'do the same as above, but for releasing the key
KInput.wVk = bKey ' the key we're going to realease
KInput.dwFlags = KEYEVENTF_KEYUP ' release the key
GInput(1).dwType = INPUT_KEYBOARD ' keyboard input
CopyMemory GInput(1).xi(0), KInput, Len(KInput)
'send the input now
Call SendInput(2, GInput(0), Len(GInput(0)))
End Sub
序列 地址 名字
00000001 100010E0 RegisterGetMousePosHook
00000003 10001120 RegisterKeyboardHook
00000002 10001110 UnRegisterGetMousePosHook
00000004 10001150 UnRegisterKeyboardHookhook.dll导入, KERNEL32.dll
顺序 (示意) 名字
000000B3 FreeEnvironmentStringsW
000002D2 WideCharToMultiByte
00000106 GetEnvironmentStrings
00000156 GetStringTypeW
00000153 GetStringTypeA
0000022F RtlUnwind
000001BF LCMapStringA
000000CA GetCommandLineA
00000174 GetVersion
0000007D ExitProcess
0000029E TerminateProcess
000000F7 GetCurrentProcess
000000FA GetCurrentThreadId
000002A5 TlsSetValue
000002A2 TlsAlloc
000002A3 TlsFree
000002A4 TlsGetValue
0000026D SetHandleCount
00000152 GetStdHandle
00000115 GetFileType
00000150 GetStartupInfoA
00000055 DeleteCriticalSection
00000124 GetModuleFileNameA
000000B2 FreeEnvironmentStringsA
00000126 GetModuleHandleA
000001E4 MultiByteToWideChar
000001C0 LCMapStringW
00000108 GetEnvironmentStringsW
0000019D HeapDestroy
0000019B HeapCreate
000002BF VirtualFree
0000019F HeapFree
000002DF WriteFile
000001AA InitializeCriticalSection
00000066 EnterCriticalSection
000001C1 LeaveCriticalSection
00000199 HeapAlloc
000000BF GetCPInfo
000000B9 GetACP
00000131 GetOEMCP
000002BB VirtualAlloc
000001A2 HeapReAlloc
0000013E GetProcAddress
000001C2 LoadLibraryAhook.dll导入, USER32.dll
顺序 (示意) 名字
00000262 SetWindowsHookExA
00000286 UnhookWindowsHookEx
00000015 CallNextHookEx
00000112 GetKeyState
000001DE PostMessageA导入, MSVCRT.dll
顺序 (示意) 名字
00000249 exit
0000008F _acmdln
00000058 __getmainargs
0000010F _initterm
00000083 __setusermatherr
00000048 _XcptFilter
0000009D _adjust_fdiv
0000006A __p__commode
0000006F __p__fmode
00000081 __set_app_type
000000B7 _controlfp
0000002E ?terminate@@YAXXZ
000000CA _except_handler3
0000000E ??1type_info@@UAE@XZ
00000186 _onexit
00000055 __dllonexit
000001B9 _splitpath
000002D4 toupper
000002B5 sscanf
000002C1 strncpy
00000252 fgets
00000159 _mbscmp
00000257 fopen
00000258 fprintf
0000024C fclose
00000049 __CxxFrameHandler
000001AA _setmbcp
000001CB _strupr
000001C1 _stricmp
000000D3 _exit导入, KERNEL32.dll
顺序 (示意) 名字
0000037B WritePrivateProfileStringA
0000019C GetStartupInfoA
00000167 GetModuleHandleA
0000015A GetLastError
00000057 CreateMutexA
00000185 GetPrivateProfileStringA
00000046 CreateEventA
000000C1 FindClose
00000042 CreateDirectoryA
000000C5 FindFirstFileA
0000002C CloseHandle
000000CE FindNextFileA
000002A9 ResetEvent
00000329 Sleep
000002EC SetEvent
0000017F GetPrivateProfileIntA
00000078 DeleteFileA
00000365 WaitForSingleObject导入, USER32.dll
顺序 (示意) 名字
0000004A CopyRect
000001B7 LoadCursorA
0000023B SendMessageA
00000008 AppendMenuA
0000015C GetSystemMenu
000000B6 DrawIcon
000000FF GetClientRect
000000BC DrawTextA
000001BB LoadIconA
000001A6 IsIconic
0000010B GetCursorPos
000000DE EnumWindows
00000177 GetWindowTextA
000000F2 GetAsyncKeyState
000002C7 VkKeyScanA
000002D6 keybd_event
000001D3 MapVirtualKeyA
00000117 GetForegroundWindow
000002D7 mouse_event
00000257 SetForegroundWindow
0000024D SetCursor
0000015D GetSystemMetrics
000000C4 EnableWindow希望有高手帮我解决这个问题,或利用连器中的hook.dll函数
如exec config.cfg 就得了,有办法么??因为在游戏中按下V键就是执行这个动作,并且这些按键命令在游戏中都是可以更改的
最后一个参数改为1试试。
最后一个参数改为1试试。一样不行呀,CSDN的高手都来帮下我呀,这东西很实用哦,别人能实现的东西怎么我实现不了,高手请出招吧,不要犹豫了,该出手就出手,Come On..
就行,可在CS里就没效了高手继续
所有太快反而没有响应,例如:b43这几个键,按B后要等网络服务
响应才会继续接收4,响应了4才响应3,在网络延时高的情况,手工按键都
会明显出现以上丢键的情况,更不用说你程序进行发送了。
建议你在CS内设置好单键或者根据网络延时来进行延时发送原则。
CS游戏进行时是全局HOOK的,只要运行,即使焦点不在CS,CS仍然会响应相应按键。
所有太快反而没有响应,例如:b43这几个键,按B后要等网络服务
响应才会继续接收4,响应了4才响应3,在网络延时高的情况,手工按键都
会明显出现以上丢键的情况,更不用说你程序进行发送了。
建议你在CS内设置好单键或者根据网络延时来进行延时发送原则。
CS游戏进行时是全局HOOK的,只要运行,即使焦点不在CS,CS仍然会响应相应按键。应该不是楼上的这个原因,我本来是局域网服务器测试的,可是发送后即可等很久也没反应,即使是单机发送也没有成功!但用别人做的按键精灵就很正常,你说怎解释!
它还能直接发送指令到游戏程序里,不用模拟按键,真不知是怎样实现的,高手见过这东西吗?http://www.sothink.com.cn/csmate/
下面这个就是我自己做的,就是缺少它那种接口的东东http://npower.vicp.net/shownews.asp?id=132我的需要按V键才能发送出动,它的能直接回车就能送!