FindWindowEx无法找到子窗口?
Dim QQhWnd As Long
Dim CombohWnd As Long
QQhWnd = FindWindow( "#32770 ", "QQ2007设置 ")
CombohWnd = FindWindowEx(QQhWnd, 0, "#32770 ", 0)
CombohWnd = FindWindowEx(CombohWnd, 0, "#32770 ", 0)
CombohWnd = FindWindowEx(CombohWnd, 0, "ComboBox ", 0)
Text2.Text = CombohWnd
但是用spy++就能找到。用getdlgitem也不行,是怎么回事,该怎么解决?
想自己做一个qq修改性别的.
uses
Windows,
Messages;
{$R MyICO.res}
var
Inst, Handle, Button1, Label1,Label2, Label3, Label4, Edit1: Integer;
Msg: TMsg;
hFont: Integer;
WinClass: TWndClassA;
procedure AddtoQQ;
var
Text: PChar;
Textlength: Integer;
S: String;
QQHwnd:HWND;
CobHwnd:HWND;
begin
TextLength := GetWindowTextLength(Edit1);
GetMem(Text, TextLength + 1);
GetWindowText(Edit1, Text, TextLength + 1);
QQHwnd:=FindWindow(nil, 'QQ2006设置 ');
if QQHwnd = 0 then
QQHwnd:=FindWindow(nil, 'QQ2007设置 ') ;
if QQHwnd <> 0 then
CobHwnd:=FindWindowEx(QQHWND,0, '#32770 ',nil);
if CobHwnd <> 0 then
CobHwnd:=FindWindowEx(CobHwnd,0, '#32770 ',nil);
if CobHwnd <> 0 then
CobHwnd:=FindWindowEx(CobHwnd,0, 'ComboBox ',nil);
if CobHwnd <> 0 then
begin
SendMessage(CobHwnd, CB_ADDSTRING, 0, Longint(PChar(text)));
Messagebox(0,pchar( '已经将 '+Text+ ' 添加到QQ性别列表框中! '),pchar( '提示 '),0+64);
end;
if CobHwnd = 0 then
Messagebox(0,pchar( '无法找到QQ性别列表框,请先打开QQ个人设置! '),pchar( '提示 '),0+64);
end;
这个delphi源码都能找到.为什么我的就不行.
[解决办法]
//CombohWnd = FindWindowEx(QQhWnd, 0, "#32770 ", 0)
你把最后一个0换成vbnullstring,其余类似语句中的也要换掉
对了,贴出你的api声明
[解决办法]
或者你传 " "是一样的在C++中可以用0表示吧
c++中好像NULL是等于0