Jump to content
  • Advertisement


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


Icon selector

This topic is 5808 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
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.


//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);
FileName:array[0..1000-1] of Char;
//32bit signed integers

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

//Set to whatever index you want (index is zero based, and determines which icon in the file is selected

if PickIconDlgA(0,FileName,FileNameBufferLength,Index) then
//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


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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!