DELPHI中该如何调用windows系统图标

netboy 2000-02-02 12:13:00
我是新手,请教众大虾“DELPHI中该如何调用windows系统图标”。
...全文
315 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Venne 2000-02-02
  • 打赏
  • 举报
回复
WINDOWS下面SYSTEM下的SHELL32.DLL包含你要的图标,调用方法和上面一样。
渤海海峡 2000-02-02
  • 打赏
  • 举报
回复
这是w95filelist程序中的一个过程。
w95filelist可以在深度历险的范例中找到。

procedure Createimages; // Sets the system's imagelists for the listview
var
SysIL: uint;
SFI: TSHFileInfo;
begin
{ Credits to Brad Stowers bstowers@pobox.com or 72733,3374 on CompuServe.}
{ I ripped most of the shell-stuff of this app from his components. But because I'm quite
worry about the C-design of shellapi and shlobj, i use only the shell-routines i really
need for this program. Maybe a few other Delphi-programmers have also trouble with ^TIID...}


{ Create the image list. We don't really "create" one. We fool SHGetFileInfo into
giving us the system's image list and use it's handle. You'd think it would be
easier to get the handle of the system image list.... }

Larges := TImageList.Create(form1);
SysIL := SHGetFileInfo('', 0, SFI, SizeOf(SFI), SHGFI_SYSICONINDEX or SHGFI_LARGEICON);
if SysIL <> 0 then begin
Larges.Handle := SysIL;
Larges.ShareImages := TRUE; // DON'T FREE THE SYSTEM IMAGE LIST!!!!! BAD IDEA (tm)!
end;
Smalls := TImageList.Create(form1);
SysIL := SHGetFileInfo('', 0, SFI, SizeOf(SFI), SHGFI_SYSICONINDEX or SHGFI_SMALLICON);
if SysIL <> 0 then begin
Smalls.Handle := SysIL;
Smalls.ShareImages := TRUE; // DON'T FREE THE SYSTEM IMAGE LIST!!!!! BAD IDEA (tm)!
end;

{ Setting the imagelists for the ListView}

form1.files.smallimages := smalls;
form1.files.largeimages := larges;

end; // End createimages
xubin_sh 2000-02-02
  • 打赏
  • 举报
回复
用LoadIcon系统api

IDI_APPLICATION Default application icon.
IDI_ASTERISK Same as IDI_INFORMATION.
IDI_ERROR Hand-shaped icon.
IDI_EXCLAMATION Same as IDI_WARNING.
IDI_HAND Same as IDI_ERROR.
IDI_INFORMATION Asterisk icon.
IDI_QUESTION Question mark icon.
IDI_WARNING Exclamation point icon.
IDI_WINLOGO Windows logo icon.

LoadIcon(NULL,IDI_XXX);(C++)
loadicon(nil,IDI_XXX);(pascal)
929 2000-02-02
  • 打赏
  • 举报
回复
不知你所说WINDOWS系统图标指什么?但在WINDOWS中,很多应用程序的图标都是从MORICONS.DLL中取出的,它存放在WINDOWS目录中。可用LOADLIBRARY把这个DLL装入,然后用FINDRESOURCE和LOADRESOURCE,LOCKRESOURCE这些API把资源装入。其它的WINDOWS图标也可用此方法装入,然后利用其资源图标。观察EXE和DLL中图标可用RESOURCE WORKSHOP 或VC中的资源编辑器来完成。

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧