Everything under Fivewin

Re: Everything under Fivewin

Postby Antonio Linares » Mon Nov 21, 2022 12:53 pm

Dear Jimmy,

It seems that you have a typo here:
DLL FUNCTION Everything_SetRequestFlags( nFlag AS DWORD ) AS VOID PASCAL FROM "Everything_SetSearchA" LIB hDll

it should be:
DLL FUNCTION Everything_SetRequestFlags( nFlag AS DWORD ) AS VOID PASCAL FROM "Everything_SetRequestFlags" LIB hDll
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Everything under Fivewin

Postby Jimmy » Wed Nov 23, 2022 1:10 pm

hi,

this CODE seems to work
Code: Select all  Expand view
#include "FiveWin.ch"
#include "EVERY.CH"

STATIC hDLL

DLL FUNCTION Everything_GetBuildNumber() AS LONG PASCAL FROM "Everything_GetBuildNumber" LIB hDll
DLL FUNCTION Everything_SetSearchA( cSearch AS LPSTR ) AS VOID PASCAL FROM "Everything_SetSearchA" LIB hDll
DLL FUNCTION Everything_QueryA( lWait AS BOOL ) AS BOOL PASCAL FROM "Everything_QueryA" LIB hDll
DLL FUNCTION Everything_GetNumResults() AS LONG PASCAL FROM "Everything_GetNumResults" LIB hDll
// need to check Parameter Type
DLL FUNCTION Everything_SetRequestFlags( nFlag AS DWORD ) AS VOID PASCAL FROM "Everything_SetRequestFlags" LIB hDll
DLL FUNCTION Everything_GetResultFullPathNameA( nNum AS _INT, cBuffer AS LPSTR, nSize AS _INT ) AS VOID PASCAL FROM "Everything_GetResultFullPathNameA" LIB hDll

PROCEDURE Main()
LOCAL aList  := {}
LOCAL oWnd, oListbox, cPath, oFont
LOCAL oText_1, cFilter := SPACE( 32 )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 20
      ACTIVATE FONT oFont
#IFDEF __HMG__
   END FONT
#ENDIF

   DEFINE WINDOW oWnd FROM 0, 0 TO 600, 400 PIXEL TITLE "Search With Everything" ICON "A1MAIN" NOMINIMIZE NOMAXIMIZE

      @ 40,  0 LISTBOX oListbox VAR cPath ITEMS aList SIZE 400 - 20, 600 - 80 PIXEL FONT oFont ;
              ON DBLCLICK( GoFindFile( TRIM( cPath ) ), oWnd:End() ) ;
              OF oWnd

      @ 010, 010 GET oText_1 VAR cFilter SIZE 360, 30 PIXEL PICTURE "@!" FONT oFont OF oWnd UPDATE VALID EverySearch( cFilter, oListbox )

      oWnd:bResized := { | nType, nWidth, nHeight | oWnd:SetSize( 400, 600 ) }

#IFDEF __HMG__
   END WINDOW
#ENDIF

   oText_1:SetFocus()
   ACTIVATE WINDOW oWnd CENTER

RETURN

STATIC PROCEDURE GoFindFile( cPath )
   MsgInfo( cPath )
RETURN

FUNCTION EverySearch( cText, oListbox )
LOCAL n, nNum, buf, nRet, bufsize := 250
LOCAL aResult := {}
LOCAL cItem, aItems := {}

   IF IsWin64()
      hDll = LoadLibrary( "everything64.dll" )
   ELSE
      hDll = LoadLibrary( "everything32.dll" )
   ENDIF
   //    MsgInfo( Everything_GetBuildNumber() )

   Everything_SetSearchA( cText )
   Everything_SetRequestFlags( nOr( EVERYTHING_REQUEST_PATH, EVERYTHING_REQUEST_FILE_NAME, EVERYTHING_REQUEST_SIZE ) )

   Everything_QueryA( .T. )
   nNum := Everything_GetNumResults()
   FOR n := 1 TO nNum
      buf := SPACE( bufsize )
      nRet := Everything_GetResultFullPathNameA( n, @buf, bufsize )
      AADD( aResult, UPPER( TRIM( buf ) ) )
   NEXT
   FreeLibrary( hDll )

   // sort it here
   aResult := ASORT( aResult )
   nNum := LEN( aResult )

   FOR n := 1 TO nNum
      cItem := aResult[ n ]
      cItem := STRTRAN( cItem, CHR( 0 ), "" )
      cItem := TRIM( cItem )
      IF EMPTY( cItem )
         LOOP
      ENDIF
      AADD( aItems, cItem )
   NEXT

   oListbox:SetItems( aItems )
   oListbox:refresh()

RETURN .T.

*+ EOF: EVERY2.PRG

it use "A"nsi Function, not sure if we nee "W"ide Function for Fivewin

have fun
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1612
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Everything under Fivewin

Postby Antonio Linares » Wed Nov 23, 2022 3:49 pm

Dear Jimmy,

many thanks for sharing it!

ansi is perfectly fine unless you need to manage unicode names
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 125 guests