Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

TheSorcerer

Icon selector

This topic is 5723 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m trying to create an icon selector windows. Like this one: Is this a Common Dialog? If not then I have another question. I have a list box that shows icons. How do I put those icons in there?

Share this post


Link to post
Share on other sites
Advertisement
You need an image list. After that, you attach the image list to the list box.

---------------------------------------------
"Love is a disease"

Share this post


Link to post
Share on other sites
Yes, it is a common dialog. If you give me a few minutes I mind be able to post some code.

Code:


    
//Import a function from the shell32.dll

function PickIconDlgA(OwnerWnd: HWND; PFileName: PAnsiChar; var FileNameBufferLength: Integer; var lpdwIconIndex: Integer): LongBool; stdcall; external 'SHELL32.DLL' index 62;

procedure TForm1.Button1Click(Sender: TObject);
var
FileName:array[0..1000-1] of Char;
//32bit signed integers

FileNameBufferLength, Index: Integer;
begin
FileNameBufferLength:=1000;
//Set to whatever file you want to open

StrPCopy(FileName,'c:\winnt\system\system32.dll');
//Set to whatever index you want (index is zero based, and determines which icon in the file is selected

Index:=10;
if PickIconDlgA(0,FileName,FileNameBufferLength,Index) then
begin
//User picked an icon

//Filename has the name of the file the icon is in

//Index has the index within the file

//You can now use ExtractIcon or ExtractIconEX to get it

end;
end;


EDIT: Just to make it clear how the Delphi syntax works. The second parameter, FileName, is being passed as a *pointer* to the array, not the array itself. Hopefully that avoids some confusion

[edited by - michalson on January 19, 2003 8:58:28 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!