想实现这样的目标:
QQ2004_2版中登录界面有一个"网络设置"的按钮,点击后会有一个展开的对话框,在里面有个"类型",可以选取"不使用代理""SOCKS5代理""HTTP代理""使用浏览器设置",默认情况下是第一个, 现在我想通过拦截消息,实现当用户按下"登录"按钮时,自动选取"HTTP代理",并填上相应的地址和端口,于是我这样做if( (pMsg->message==0x00000001||pMsg->message==0x00003e88||pMsg->message==0x00000069)&&(pMsg->wParam)==WM_COMMAND)//消息号0X00000001为"登录"按钮的ID,0X00003e88为"网络设置"按钮的ID,0X000069为"申请QQ"的ID
.....判断是不是QQ登录窗口.....如是:
//让"网络设置"对话框显示
::PostMessage((HWND)pMsg->lParam,WM_COMMAND,0x00003E88,LONG(GetDlgItem((HWND)pMsg->lParam,0x00003E88)));//选中类型的"HTTP代理"
::PostMessage(GetDlgItem((HWND)pMsg->lParam,0x00003E81),CB_SETCURSEL,2,NULL);//这一步实现了HWND IpaddrEdit=GetDlgItem((HWND)pMsg->lParam,0x00003E82);//得到ip地址窗口句柄
HWND IPortEdit=GetDlgItem((HWND)pMsg->lParam,0x00003E84);//得到端口窗口句柄
接下来的这二步不管怎么弄,就是不能填
SetWindowText(IpaddrEdit,"192.168.1.1");//SetDlgItemText((HWND)pMsg->lParam,0x3E82,,"192.168.1.1");
SetWindowText(IPortEdit,"80");于是在此两句前加上一堆spy++侦测到的消息
::PostMessage(IpaddrEdit, WM_SETFOCUS, 0,0);
::PostMessage(IpaddrEdit, WM_ENABLE, 1,0);如果我们是用鼠标来选"HTTP代理"的话,会使IpaddrEdit和IPortEdit变得可写啊,那我这样做怎么不行?
请高手指点我该如何实现???
QQ2004_2版中登录界面有一个"网络设置"的按钮,点击后会有一个展开的对话框,在里面有个"类型",可以选取"不使用代理""SOCKS5代理""HTTP代理""使用浏览器设置",默认情况下是第一个, 现在我想通过拦截消息,实现当用户按下"登录"按钮时,自动选取"HTTP代理",并填上相应的地址和端口,于是我这样做if( (pMsg->message==0x00000001||pMsg->message==0x00003e88||pMsg->message==0x00000069)&&(pMsg->wParam)==WM_COMMAND)//消息号0X00000001为"登录"按钮的ID,0X00003e88为"网络设置"按钮的ID,0X000069为"申请QQ"的ID
.....判断是不是QQ登录窗口.....如是:
//让"网络设置"对话框显示
::PostMessage((HWND)pMsg->lParam,WM_COMMAND,0x00003E88,LONG(GetDlgItem((HWND)pMsg->lParam,0x00003E88)));//选中类型的"HTTP代理"
::PostMessage(GetDlgItem((HWND)pMsg->lParam,0x00003E81),CB_SETCURSEL,2,NULL);//这一步实现了HWND IpaddrEdit=GetDlgItem((HWND)pMsg->lParam,0x00003E82);//得到ip地址窗口句柄
HWND IPortEdit=GetDlgItem((HWND)pMsg->lParam,0x00003E84);//得到端口窗口句柄
接下来的这二步不管怎么弄,就是不能填
SetWindowText(IpaddrEdit,"192.168.1.1");//SetDlgItemText((HWND)pMsg->lParam,0x3E82,,"192.168.1.1");
SetWindowText(IPortEdit,"80");于是在此两句前加上一堆spy++侦测到的消息
::PostMessage(IpaddrEdit, WM_SETFOCUS, 0,0);
::PostMessage(IpaddrEdit, WM_ENABLE, 1,0);如果我们是用鼠标来选"HTTP代理"的话,会使IpaddrEdit和IPortEdit变得可写啊,那我这样做怎么不行?
请高手指点我该如何实现???
当你的QQ用HTTP代理后,那么下一次登录可以通过上面的代理实现IP的转变,如你上一次是192.168.1.1:80,现在想改为192.168.1.2:1080,上面的代码可以实现,但如果上次没有用代理,那么就不行!!
别外,上面的IP地址不是ipaddress格式,是一般的EDIT!!
QQ改窗口属性会通过CBN_SELCHANGE事件,
所以你应该再发一个CBN_SELCHANGE消息,详见MSDN
CBN_SELCHANGE Notification--------------------------------------------------------------------------------The CBN_SELCHANGE notification message is sent when the user changes the current selection in the list box of a combo box. The user can change the selection by clicking in the list box or by using the arrow keys. The parent window of the combo box receives this notification in the form of a WM_COMMAND message with CBN_SELCHANGE in the high-order word of the wParam parameter. SyntaxCBN_SELCHANGE WPARAM wParam
LPARAM lParam;
ParameterswParam
The low-order word specifies the control identifier of the combo box.
The high-order word specifies the notification message. lParam
Handle to the combo box.
Return ValueNo return value.
ResTo get the index of the current selection, send the CB_GETCURSEL message to the control.The CBN_SELCHANGE notification message is not sent when the current selection is set using the CB_SETCURSEL message. Notification RequirementsMinimum DLL Version None
Header Declared in Winuser.h, include Windows.h
Minimum operating systems Windows 95, Windows NT 3.1 See Also
WPARAM msg=0x00013E81;::PostMessage(GetDlgItem((HWND)pMsg->lParam,0x00003E81),WM_COMMAND,msg,LONG(GetDlgItem((HWND)pMsg->lParam,0x00003E81)));
Return Value
下拉框的句柄啊!
GetDlgItem((HWND)pMsg->lParam,0x00003E81)
发给(HWND)pMsg->lParam不是很好的主意吗?
SetWindowText(IpaddrEdit,"192.168.1.1");.....不成功.....是不是又得发EN_CHANGE给控件所在窗口?在此之前发还是之后发?
有了控件ID还不能知道其它的吗。GetDlgItem。
SetWindowText(IpaddrEdit,"192.168.1.1");//SetDlgItemText((HWND)pMsg->lParam,0x3E82,,"192.168.1.1");
SetWindowText(IPortEdit,"80");
------------------------------------------------
改成SendMessage(WM_SETTEXT,...)试试,
因为我填后用GetWindowText得到填得正确,但这时该EDIT并没有更新数据,我该发送什么消息啊
如何让主窗口知道EDIT已改变并更新数据呢?还请高手再帮帮忙!!!
SetWindowText(IpaddrEdit,"192.168.1.1");
SetWindowText(IPortEdit,"80");
并没出现什么问题,也不需发送EN_CHANGE,请极度高手解决,送500分加此100分共600百分