高手进,隐藏外部程序中文本框的内容,显示一不断变化新内容
假设上图是外部程序中一部分,现在想要隐藏或是覆盖文本部分,在那个区域显示变化的时间
外部程序不作改动,要随时能恢复显示的.有什么好解决办法,求思路
[解决办法]
Copy来的,看看有没有思路了。
使用下面这个程序可以获得其他窗体上的Tedit控件并清空它的值unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; ListBox1: TListBox; Button2: TButton; ListBox2: TListBox; Label1: TLabel; Label2: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure ListBox1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1; function EnumWindowsProc( Hwnd: HWND; MyForm: TForm1): Boolean; stdcall; //回调函数 function EnumChildControlProc( Hwnd: HWND; MyForm: TForm1): Boolean; stdcall; //回调函数, 处理返回来的窗体控件的句柄implementation{$R *.dfm}function EnumWindowsProc( Hwnd: HWND; MyForm: TForm1): Boolean; stdcall;var WndWindowText: array[0..254] of char; //用来存储窗口名begin GetWindowText(Hwnd,WndWindowText,254); MyForm.ListBox1.Items.Add('窗口名: '+StrPas(WndWindowText)); Result:= True;end;function EnumChildControlProc( Hwnd: HWND; MyForm: TForm1): Boolean; stdcall;var ComponentClassName, ComponentText: array[0..254] of char; Buffer:array[0..255]of char;begin GetClassName(Hwnd,ComponentClassName,254); GetWindowText(Hwnd, ComponentText, 254); if StrPas(ComponentClassName)='TEdit' then begin Buffer=''; SendMessage(Hwnd,WM_SETTEXT,0,Longint(@Buffer)); //使用 WM_SetText消息设置Tedit的值. end; Result:= True;end;procedure TForm1.Button1Click(Sender: TObject);begin ListBox1.Items.Clear; EnumWindows(@EnumWindowsProc, Longint(self)); // 注册回调函数入口地址的函数end;procedure TForm1.Button2Click(Sender: TObject);var Hwn: HWND;begin Form1.ListBox2.Items.Clear; ListBox2.Items.Add('有如下控件名称'); Hwn:= FindWindow(nil,PChar(Label2.Caption)); if Hwn<>0 then EnumChildWindows(Hwn,@EnumChildControlProc,LongInt(Self)) else MessageBox(self.Handle,'没有获得该窗口句柄','提示',0);end;procedure TForm1.ListBox1Click(Sender: TObject);begin Label2.Caption:=Copy(ListBox1.Items.Strings[ListBox1.itemIndex],9,Length(ListBox1.Items.Strings[ListBox1.itemIndex]));end;end.
[解决办法]
不要忘了,楼主还要取Edit中的文本呢,如果拦截了消息并改变内容,楼主取到的必定是不正确的内容。
我感觉,你用注入的方法,把自己定义的一个窗口盖住原来的窗口可能有用。函数为SetParent,如果不用注入,而直接在你的程序中SetParent可能也行。
[解决办法]
那不是得用360对QQ那一招了?
[解决办法]
直接贴图上去,不断的获取目标程序的位置然后把预先准备好的图片直接贴上去。
[解决办法]
注入模式应该是没有问题
[解决办法]
获取位置大小, 一个窗体独立在那个RECT显示并画东西
[解决办法]
你可以自己花个和他一样的文本框 然后置前就好了啊