用Delphi编程如何判断电脑中运行的QQ号是多少?(100)

  • 主题发起人 主题发起人 wjshh
  • 开始时间 开始时间
W

wjshh

Unregistered / Unconfirmed
GUEST, unregistred user!
我做了个软件,想用QQ号来验证用户身份。 就是检测到QQ号已登录了就可以使用软件。请大家帮忙
 
启动1个或者多个qq后,运行下面代码看效果:procedure TForm1.Button1Click(Sender: TObject);var H: HWND;
lpClassName: PChar;
s:String;
begin
H := FindWindow(nil, nil);
lpClassName := StrAlloc(200);
while H <> 0 do
begin
GetClassName(H, lpClassName, 200);
s:= StrPas(lpClassName);
if Pos('QQ.EXE',S)>0 then
Memo1.Lines.Add( S );
//S 最后几位就是qq号码 H := GetWindow(H, GW_HWNDNEXT);
end;
end;
 
楼上你好我试了没有找到,下面是我得到的结果;Memo1MSCTFIME UIIMEtooltips_class32tooltips_class32tooltips_class32DV2ControlHosttooltips_class32tooltips_class32tooltips_class32tooltips_class32Shell_TrayWndTXGuiFoundationTHintWindowTXGuiFoundationBaseBartooltips_class32TXGuiFoundationMSCTFIME UIIMEAuto-Suggest DropdownTXGuiFoundationTXGuiFoundationTXGuiFoundationTXGuiFoundationTXGuiFoundationSysFaderIMEtooltips_class32tooltips_class32tooltips_class32AfxFrameOrView80uMSCTFIME UIIME#32770MSCTFIME UIIMETForm1TApplicationMSCTFIME UIIMETDbEngineErrorDlgTProgressDlgTAppBuilderTPropertyInspectortooltips_class32TObjectTreeViewTEditWindowTForm1TITEfrmMainTfrmSelectFontDlgTfrmITESearchResultsTfrmITESearchFormTfrmRepositoryTDelExpertDlgTAlignPaletteTProjectManagerFormTApplicationlznImeCandwinimelznImeCompwinimelznImeStatuswinimeTipWIe0017949C.IMElznInterCodeImeIMETXGuiFoundationTXGuiFoundationTXGuiFoundationTXGuiFoundationTPopupListBoxMSCTFIME UIIMENotepadATL:04418548ATL:04418548tooltips_class32TXGuiFoundationBCWDBKSYNCHWNDtooltips_class32tooltips_class32tooltips_class32tooltips_class32#43IMETPUtilWindowTPUtilWindowTPUtilWindowShell EmbeddingShell EmbeddingShell EmbeddingComboLBoxComboLBoxComboLBoxTPUtilWindowTPUtilWindowTPUtilWindowTPUtilWindowtooltips_class32TPUtilWindowDDEMLEventDDEMLMomTPUtilWindowTPUtilWindowTPUtilWindowTPUtilWindowTPUtilWindowTPUtilWindowTPUtilWindowTPUtilWindowlznImeStatuswinimelznInterCodeImeIMEtooltips_class32lznImeStatuswinimelznInterCodeImeIMEComboLBoxComboLBoxComboLBoxComboLBoxtooltips_class32XTPToolBartooltips_class32lznImeStatuswinimelznInterCodeImeIMElznImeStatuswinimelznInterCodeImeIMElznImeStatuswinimelznInterCodeImeIMElznImeCandwinimelznImeCompwinimelznImeStatuswinimeTipWIe0017949C.IMElznInterCodeImeIMElznImeStatuswinimelznInterCodeImeIMElznImeStatuswinimelznInterCodeImeIMElznImeStatuswinimelznInterCodeImeIMEtooltips_class32tooltips_class32tooltips_class32IME#32770IMEIMEtooltips_class32IME#32770IMEAfx:400000:8:10011:1900015:0ListBoxListBoxListBoxMaxthon2_FrameInternet Explorer_HiddenComboLBoxComboLBoxInternet Explorer_HiddenXMLMimeWndInternet Explorer_HiddenXMLMimeWndATL:04418548ATL:04418548TXGuiFoundationComboLBoxComboLBoxComboLBoxtooltips_class32Internet Explorer_HiddenComboLBoxtooltips_class32tooltips_class32ATL:085D8548ComboLBoxComboLBoxComboLBoxComboLBoxComboLBoxInternet Explorer_HiddenInternet Explorer_Hiddenatlcommon_timer185052950WMPMessengerInternet Explorer_HiddenInternet Explorer_HiddenInternet Explorer_HiddenInternet Explorer_HiddenInternet Explorer_HiddenInternet Explorer_HiddenInternet Explorer_Hiddentooltips_class32OleDdeWndClassAfx:400000:0ListBoxListBoxAfx:400000:0ATL:04418548ATL:04418548TXGuiFoundation#43IMETXGuiFoundationTXHttpWindow#32770Internet Explorer_HiddenGameExchange WndATL:0630D0A0TXGuiFoundationTXGuiFoundationoicq2000countwndTXGuiFoundationtoos_MainClassKScreen_registe_classIMES32770IMEPGPtray_Hidden_WindowIMEMSCTFIME UIIMEConnections TraySystemTray_MainIMEMS_WebcheckMonitor360SafeBoxTrayWndigfxtrayClassIMEQ360SafeMonClassIMEMSCTFIME UIWorkerWWorkerWDDEMLEventDDEMLMomIMEGDI+ Hook Window ClassIMEtooltips_class32AfxWnd42uAfxWnd42AfxWnd42AfxWnd42AfxWnd42uProgman
 
我用的是qq2008,出现如下结果:C:/PROGRAM FILES/TENCENT/QQ/QQ.EXED414641A-643F-4547-8459-D36F7EE9BB0D********C:/PROGRAM FILES/TENCENT/QQ/QQ.EXED414641A-643F-4547-8459-D36F7EE9BB0D********后面几位是我qq号码,以*隐去。将GetClassName更改为GetWindowText,也可以获得上面的结果。你用的是什么版本的?我下载一个试试。
 
有意思,学习一下;可能用的是TM吧,那就改一下里面的QQ.EXE好了
 
你好我用的是QQ2009
 
2009通过上面方式无效,如果qq在托盘显示,则可以在托盘中查找,提供一种思路而已,不一定对你有用。var id: array[0..100] of integer;{$R *.dfm}procedure TFrmTray.FormCreate(Sender: TObject);var v_hShellTray: THandle;
v_hTrayNotify: THandle;
v_hToolBar: THandle;
v_SysPager: THandle;
i, j, k: integer;
Info: _TBBUTTON;
buffer: pchar;
PID: THandle;
PRC: THandle;
R: Cardinal;
S: array[0..1024] of char;
MaxWidth: integer;
begin
k := 0;
CheckListBox1.Items.Clear;
v_hShellTray := FindWindow('Shell_TrayWnd', nil);
v_hTrayNotify := FindWindowEx(v_hShellTray, 0, 'TrayNotifyWnd', nil);
v_SysPager := FindWindowEx(v_hTrayNotify, 0, 'SysPager', nil);
v_hToolBar := FindWindowEx(v_SysPager, 0, 'ToolbarWindow32', nil);
if v_hToolBar=0 then
Exit;
GetWindowThreadProcessId(v_hToolBar, @PID);
PRC := OpenProcess(PROCESS_VM_OPERATION or PROCESS_VM_READ or PROCESS_VM_WRITE, False, PID);
Buffer := VirtualAllocEx(PRC, nil, 4096, MEM_RESERVE or MEM_COMMIT, PAGE_READWRITE);
j := SendMessage(v_hToolBar, TB_BUTTONCOUNT, 0, 0);
for i := 0 to j - 1 do
begin
FillChar(Info, SizeOf(Info), 0);
WriteProcessMemory(PRC, Buffer, @Info, SizeOf(Info), R);
SendMessage(v_hToolBar, TB_GETBUTTON, i, integer(Buffer));
ReadProcessMemory(PRC, Buffer, @Info, SizeOf(Info), R);
if Info.iString <> -1 then
begin
k := k + 1;
if not Boolean(SendMessage(v_hToolBar, TB_ISBUTTONHIDDEN, Info.idCommand, 0)) then
begin
SendMessage(v_hToolBar, TB_GETBUTTONTEXT, Info.idCommand, integer(integer(@Buffer[0]) + SizeOf(Info)));
ReadProcessMemory(PRC, Pointer(integer(@Buffer[0]) + SizeOf(Info)), @S[0], SizeOf(S), R);
id[k - 1] := Info.idCommand;
CheckListBox1.Items.Add(S);
CheckListBox1.Checked[k - 1] := false;
end else
begin
SendMessage(v_hToolBar, TB_GETBUTTONTEXT, Info.idCommand, integer(integer(@Buffer[0]) + SizeOf(Info)));
ReadProcessMemory(PRC, Pointer(integer(@Buffer[0]) + SizeOf(Info)), @S[0], SizeOf(S), R);
id[k - 1] := Info.idCommand;
CheckListBox1.Items.Add(S);
CheckListBox1.Checked[k - 1] := true;
end;
end;
end;
VirtualFreeEx(PRC, Buffer, 0, MEM_RELEASE);
CloseHandle(PRC);
MaxWidth := 0;
for i := 0 to CheckListBox1.Items.Count - 1 do
if MaxWidth < CheckListBox1.Canvas.TextWidth(CheckListBox1.Items.Strings) then
MaxWidth := CheckListBox1.Canvas.TextWidth(CheckListBox1.Items.Strings);
SendMessage(CheckListBox1.Handle, LB_SETHORIZONTALEXTENT, MaxWidth + 40, 0);
end;
 
znxia,你好:编译不过去呀 _TBBUTTON;是什么类型?
 
uses CommCtrl,ShellAPI;
 
znxia,你好:好使了,非常感谢你。能给程序添加个注释吗?
 
发现一个问题在QQ来消息的时候,就检测不到QQ号了。
 
谁来帮我解决这个问题?
 
后退
顶部