小弟我学着写外挂,可是游戏窗体一定要在最前面才行,怎么办?
Private Sub Command1_Click()
Dim hwnd As Long
hwnd = FindWindow(vbNullString, "Element Client ")
If hwnd = 0 Then
MsgBox "武林客户端没有运行 ", vbOKOnly, "错误 "
Exit Sub
Else
...................
如果游戏客户端不在最前面,那么就会将键盘值发送到最前面的窗体上去了,有什么办法可以锁定那个Element Client窗体,就算最小化也能SendKeys "1 "
[解决办法]
用sendmesseng
[解决办法]
or postmesseng
[解决办法]
同意楼上
[解决办法]
SendMessage或PostMessage,武林使劲按1吃东西,最好用PostMessage
窗体置顶用SetWindowPos ,带参数HWND_TOPMOST
[解决办法]
hwnd = FindWindow(vbNullString, "Element Client ")得到Element Client窗口句柄
SetWindowPos(hwnd,HWND_TOPMOST,X,Y,CX,CY,uFlag)(X,Y,CX,CY,uFlag)设置Element Client最前
int X, // horizontal position
int Y, // vertical position
int cx, // width
int cy, // height
UINT uFlags // window-positioning flags
[解决办法]
mark
[解决办法]
Public Declare Function PostMessage Lib "user32 " Alias "PostMessageA " (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Function PostClick(Gamehwnd As Long, x As Long, y As Long)
PostMessage Gamehwnd, WM_LBUTTONDOWN, 0, (x And &HFFFF) + (y And &HFFFF) * &H10000
PostMessage Gamehwnd, WM_LBUTTONUP, 0, (x And &HFFFF) + (y And &HFFFF) * &H10000
End Function
呵呵,前阵子刚好也写过一个外挂,PostClick是我写的一个函数,x,y轴的点你就自己去测算啦
[解决办法]
游戏里需要点哪个地方,就: Call PostClick(游戏句柄,X轴点,Y轴点)
有的游戏是屏蔽PostMessage 和 SendMessage 消息的,这样你发过去可能没有反应!
需要先破解,碰到这个问题的就比较麻烦啦!~~~
[解决办法]
用SendKeys需要窗体为当前活动窗体,用PostMessage 就不需要,即使窗体被遮挡也可以
[解决办法]
可以看看这个,有PostMessage 的用法
http://community.csdn.net/Expert/topic/5252/5252514.xml?temp=.6436273
[解决办法]
结贴了没?用VB写武林外挂。
最好使用postMESSAGE,可以同时挂机多个窗口。
[解决办法]
VC写的,参考一下
void CFSDlg::OnTest()
{
// TODO: Add your control notification handler code here
HANDLE Process=NULL;
if( MyOpenProcess( &Process ) )//打开进程
{
AfxMessageBox( "**游戏 未运行! ");
return;
}
HWND cWnd = ::FindWindow(NULL, "**游戏 ");
if( cWnd == NULL )
return ;
lBaseAddr=0x01B18AE0;
/*
if( ReadProcessMemory(Process,(LPVOID)(lBaseAddr),&lRenAdd,4,NULL) == TRUE )//读取封神版内存数据
{
CString aaa;
aaa.Format( "%d ",lRenAdd);
::AfxMessageBox(aaa);
}
CloseHandle(Process);
*/
::SetForegroundWindow(cWnd);//设置窗口向前
::SetActiveWindow(cWnd);//激活窗口
int iKey= 49;//49是1键
::keybd_event(VK_F5,0,0,0);
::keybd_event(VK_F5,0,KEYEVENTF_KEYUP,0);
}