谢谢
解决方案 »
- 300分 求修改内存实例
- 求建议:“工作半年了,觉得用本科生的身份混下去,前途不会太好,打算考研!”顺便散分。
- 大家帮忙解决一下
- 怎么才能将一个文件(exe,word,excel)写入数据库(SQL)
- 求教mdi窗体的问题
- powerpoint application invisible 无法打开Presentation
- SQL很好的东西!就是驾驭不了!这是什么原因啊!
- 紧急求援:如何让程序在执行过程中间挂起一段时间,不用showmessage方式。
- 推销自己的homepage, 请您看后在留言本里提提意见。一定给分。
- 自信能给出不错的意见就给分!不够在加
- 光标在DbGrid中的移动
- 关于动态控制一个控件位置的问题
var
lpBuf : Array [0..255] of char;
begin
Result := True;
if (GetWindowText(EnumHandle,@lpBuf,255) > 0) //then
and (GetWindowLong(EnumHandle, GWL_EXSTYLE or WS_EX_OVERLAPPEDWINDOW) <> 0 ) then
begin
if Pos('Unit1',StrPas(lpBuf)) > 0 then
begin
Form1.Memo1.Lines.add('Form Caption -- Form Handle');
Form1.Memo1.Lines.add(lpBuf + ' -- ' + IntToStr(EnumHandle));
end;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
EnumWindows(@MyEnumCallBack,0);
end;
EnumWindows(@MyEnumCallBack, 0);//如果后面的0改为integer(self)有没有区别?欢迎到这里灌水:http://expert.csdn.net/Expert/topic/1521/1521364.xml?temp=.8649713
EnumWindows(@MyEnumCallBack,Integer(Self));是可以的,它只是作为一个参数被调用
上面程序改一下为
Function MyEnumCallBack (EnumHandle : HWnd; EnumValue : Integer) : Boolean; Stdcall;
var
lpBuf : Array [0..255] of char;
begin
Result := True;
if (GetWindowText(EnumHandle,@lpBuf,255) > 0) //then
and (GetWindowLong(EnumHandle, GWL_EXSTYLE or WS_EX_OVERLAPPEDWINDOW) <> 0 ) then
begin
if Pos('Unit1',StrPas(lpBuf)) > 0 then
begin
TForm(EnumValue).Caption := 'hello';
Form1.Memo1.Lines.add('Form Caption -- Form Handle');
Form1.Memo1.Lines.add(lpBuf + ' -- ' + IntToStr(EnumHandle));
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
EnumWindows(@MyEnumCallBack,Integer(Self));end;