function MyGetWindowIcon(H:Hwnd):Hicon;
begin
result:=GetClassLong(H,GCL_HICON); //第一种方法取图标
if ico=0then
result:=sendmessage(h,wm_geticon,icon_big,0);//第二种方法取
end;
返回值:非0:表示取到了图标,返回值为取得的图标的句柄
0: 表示取不到图标
参数说明:
H:Hwnd,为所要取图标的窗口的句柄.
调用方法:
procedure Tform1.button1click(sender:tobject);
var
h:hwnd;
ico:hico;
begin
h:=findwindow('Notepad',nil);
ico:=myGetWindow(h);
if ico<>0then
image1.picture.icon.handle:=ico;
end;
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.034526109695435 seconds