Search the Community
Showing results for tags 'pickicondlg()'.
Found 1 result
Hello, i did not find much information about this function but i would like to use it (or does delphi bring own dialog with that ability?) Here is wrapper i use: uses ShlObj; ... function PickIconDialog( IconHandle: HWND; var Filename: string; var IconIndex: Integer ): Boolean; var tmp : String; idx: Integer; begin Result := False; tmp := Filename; idx := IconIndex; if ( PickIconDlg( IconHandle, PWideChar( tmp ), 1023, idx ) <> 0 ) then begin Filename := String( tmp ); IconIndex := idx; Result := True; end; end; This is how i call it: procedure TfrmMain.btnGetIconClick(Sender: TObject); var IconFile: String; IconIndex: LongInt; begin IconFile := ''; IconIndex := 0; try IconIndex := StrToInt( edIconIndex.Text ); except IconIndex := 0; end; if ( PickIconDialog( Handle, IconFile, IconIndex ) = True ) then begin edIconLocation.Text := IconFile; try edIconIndex.Text := IntToStr( IconIndex ); except edIconIndex.Text := '0'; end; Image1.Picture.Icon.Handle := ExtractIcon( hInstance, PWideChar( IconFile ), Cardinal( IconIndex ) ); end; end; What happen is, i get correct Icon displayed but... Iconfilename often is invisible. Other edit fields are invisible overwritten with Value of Iconfilename, Most of time, every field that has no value on start will be invisible overwritten. (ATM i do by workaround, i fill every field before operation with any data) Do i use it wrong? Does better ways exists to have such dialog?