BT_DirectoryInfo()

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2108
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

BT_DirectoryInfo()

Post by AUGE_OHR »

i have found "HMG_EasyBuild.prg"*** which work with BT_DirectoryInfo() :D
***
https://www.hmgforum.com/viewtopic.php?f ... 229#p36229

1st Step is to assign BT_ImageListGetSystemIcon() to GRID "ImageList"

Code: Select all

STATIC PROCEDURE DefGridLeft( cForm, cObj, nDimStack )
   @ nRow, nCol GRID &cObj ;
           PARENT &cForm ;
   ...
   SetProperty( cForm, cObj, "ImageList", BT_ImageListGetSystemIcon() )
in 2nd Step i have some Dupe while both Array are about same ...

Code: Select all

STATIC PROCEDURE FillWithDir( cForm, cObj, cNewPath, cUpDn )

   aNewDir := DIRECTORY( cNewPath + "*.*", "DHS" )
   aFiles_Left  := BT_DirectoryInfo ( cNewPath, BT_DIRECTORYINFO_LISTALL )
---
Great Sample from Dr. Claudio Soto use these Step

Code: Select all

   FOR i = 1 TO HMG_LEN (aFiles)
      ...
      Form_1.Grid_1.AddItem (aItem)
      Form_1.Grid_1.ImageIndex (i,1) := aFiles [i] [BT_DIRECTORYINFO_INTERNALDATA_IMAGEINDEX]
---

as i have "Split" it Icon are assign in 3th Step

Code: Select all

STATIC PROCEDURE DirImageColor( aDir, cForm, cObj )
LOCAL cExt, i, iMax := LEN( aDir )
LOCAL cName, nPosi, nIndex

   FOR i := 1 TO iMax
      cName := aDir[i][F_NAME]
      IF cForm = "WinLeft"
         nPosi := ASCAN( aFiles_Left, {|e| e[BT_DIRECTORYINFO_NAME] = cName })
         IF nPosi > 0
            nIndex := aFiles_Left[nPosi][BT_DIRECTORYINFO_INTERNALDATA_IMAGEINDEX]
            SetProperty( cForm, cObj, "ImageIndex", i, 1, nIndex )
         ENDIF
      ELSEIF cForm = "WinRight"
this work fine ... but it take some time when have a Directory with many Files so i think about Thread ... :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2108
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: BT_DirectoryInfo()

Post by AUGE_OHR »

hi,

i´m confuse about BT_DirectoryInfo() to show "extenal Icon"

on i7-6700T, HD 530 it work on32 Bit OS but not on 64 OS (multi-boot)
on FX-8350, GTX 750 it does not work with Windows 10 32/64 Bit OS but work with Windows 8.1 64 Bit OS
on my Table-PC 64 Bit OS (Atom 8350) it work but not on my Media PC (i3 2330M) 64 Bit OS
on Celeron N3150 it work with 32/64 bit OS

all have latest Window 10 Version and i have check GFK Driver.
Icon are shown with Explorer or Total Commander or my 32 Bit Xbase++ App on all PC

so it might be that my Code is wrong ... any Idea :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2108
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: BT_DirectoryInfo()

Post by AUGE_OHR »

hi,

for System Imagelist i need to load

Code: Select all

  SetProperty( cForm, cObj, "ImageList", BT_ImageListGetSystemIcon() )
while have Problem on some PC i got replacement for

Code: Select all

  nIndex := aFiles_Left[ nPosi ] [ BT_DIRECTORYINFO_INTERNALDATA_IMAGEINDEX ]
  SetProperty( cForm, cObj, "ImageIndex", i, 1, nIndex )
now i use

Code: Select all

   nIndex := GETICOINDEX(cFile, 16) // small Icon 16x16
   IF nIndex > 0
     SetProperty( cForm, cObj, "ImageIndex", i, 1, nIndex )
   ENDIF
benefit : it also show Icon from *.LNK
SysIcon.jpg
SysIcon.jpg (412.85 KiB) Viewed 1434 times

Code: Select all

HB_FUNC( GETICOINDEX )
{
   int nSize = ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : 0 );

   SHFILEINFO sfi = { 0 };

   SHGetFileInfo( hb_parc( 1 ), 0, &sfi, sizeof( SHFILEINFO ), SHGFI_ICON | nSize );

   #ifndef _WIN64
      hb_retnl( ( LONG ) sfi.iIcon );
   #else
      hb_retnll( ( LONGLONG ) sfi.iIcon );
   #endif
}
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2108
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: BT_DirectoryInfo()

Post by AUGE_OHR »

hi,

here full Source Sample how to get System Imagelist Index Number for Item of DIRECTORY()
FILEICON.ZIP
(2.48 KiB) Downloaded 146 times
have fun
Jimmy
Post Reply