Alaska Software Inc. - System Icon for Drive ?
Username: Password:
AuthorTopic: System Icon for Drive ?
AUGE_OHRSystem Icon for Drive ?
on Fri, 16 Sep 2011 01:58:03 +0200
hi,

after init System Imagelist i can get System File Icon with Function below,
but how to get Drive Icon ... ( must be in System Imagelist .. )

greetings by OHR
Jimmy




*** Code ***

FUNCTION file2IconIndex( cFile, cAttr )  cFile = FullPathName
LOCAL nMax   := 352
LOCAL buffer := ChrR(0,nMax)
LOCAL nAttr  := 0
LOCAL nFlags := nOr(SHGFI_SHELLICONSIZE,SHGFI_SYSICONINDEX,SHGFI_SMALLICON)
LOCAL result

DEFAULT cAttr TO ""

   IF "D" $ cAttr
      nAttr := FILE_ATTRIBUTE_DIRECTORY    0x10
   ELSE
      nAttr := FILE_ATTRIBUTE_NORMAL       0x80
   ENDIF

   result := @shell32:SHGetFileInfoA(cFile   ,;
                                     nAttr   ,;
                                     @buffer ,;
                                     nMax    ,;
                                     nFlags   )
   IF EMPTY(result)
      RETURN 0
   ENDIF

RETURN PeekDWord(buffer,4)

*** EOF ***
AUGE_OHRRe: System Icon for Drive ?
on Wed, 05 Oct 2011 05:11:14 +0200
hi,

found out that you can use same Code when "Drive" have Syntax : 
SHGetFileInfo("C:"

Note : UPPER(cDrive) + ":"

Problem : if you still have a Floppy Disk and not insert Floppy all Drive 
Icon will be "empty"

Workaround : make some "Dummy" Icon if Floppy [-a-] or [-b-]

greetings by OHR
Jimmy