Everything under Fivewin

Everything under Fivewin

Postby Jimmy » Sun Nov 13, 2022 2:43 pm

hi,

did somebody work with Everything under Fivewin :?:
http://www.voidtools.com/

---
for Xbase++ and HMG i use DllCall but under Fivewin i got Empty Array

i guess it have to do with calling Type where is use "only" DLL_OSAPI under Xbase++
under HMG i have to use for Unicode
Code: Select all  Expand view  RUN
nNum := DllCall( nDLL, HB_DYN_CTYPE_LONG, "Everything_GetNumResults" )

or ANSI
Code: Select all  Expand view  RUN
nNum := DllCall( nDLL, HB_DYN_CTYPE_INT, "Everything_GetNumResults" )

but Fivewin sems to need "more" ... who can help

Code: Select all  Expand view  RUN
#include "DLL.CH"
#include "hbdyn.ch"

STATIC FUNCTION DOEveryThing( cMask )
LOCAL aResult := {}
LOCAL aItems  := {}
LOCAL bufsize := 250
LOCAL nRet    := 0
LOCAL nDll
LOCAL nNum, n
LOCAL cItem
LOCAL hGrid
LOCAL buf

*    nDLL := DLLCall( "Kernel32.dll",DLL_OSAPI, "LoadLibrary", "Everything32.dll" )
*    IF nDLL > 0
      nDll := "Everything32.dll"

      // set thesearch
      IF hb_cdpSelect() = "UTF8"             .or. .T.
         nRet := DllCall( nDLL,, "Everything_SetSearchW", cMask )
      ELSE
         nRet := DllCall( nDLL,, "Everything_SetSearchA", cMask )
      ENDIF
      FWLOG 1,nRet

      // request name and size
      nRet := DllCall( nDLL,, "Everything_SetRequestFlags", nOr( EVERYTHING_REQUEST_PATH, EVERYTHING_REQUEST_FILE_NAME, EVERYTHING_REQUEST_SIZE ) )
      FWLOG 2,nRet


      // sort by size
      // @Everything32:Everything_SetSort(EVERYTHING_SORT_SIZE_DESCENDING)
      // sort by name
      // @Everything32:Everything_SetSort(EVERYTHING_SORT_NAME_ASCENDING)
      // sort by path
      // @Everything32:Everything_SetSort(EVERYTHING_SORT_PATH_ASCENDING)

      nRet := DllCall( nDLL,, "Everything_SetSort", EVERYTHING_SORT_FILE_LIST_FILENAME_ASCENDING )
      FWLOG 3,nRet

      // execute the query
      IF hb_cdpSelect() = "UTF8"             .or. .T.
         nRet := DllCall( nDLL, , "Everything_QueryW", .T. )
         nNum := DllCall( nDLL, HB_DYN_CTYPE_LONG, "Everything_GetNumResults" )
      ELSE
         nRet := DllCall( nDLL,, "Everything_QueryA", .T. )
         nNum := DllCall( nDLL, HB_DYN_CTYPE_INT, "Everything_GetNumResults" )
      ENDIF
      FWLOG 4, nRet, nNum


      FOR n := 1 TO nNum
         buf := SPACE( bufsize )
         IF hb_cdpSelect() = "UTF8"          .or. .T.
            nRet := DllCall( nDLL,, "Everything_GetResultFullPathNameW", n, @buf, bufsize )
         ELSE
            nRet := DllCall( nDLL,, "Everything_GetResultFullPathNameA", n, @buf, bufsize )
         ENDIF
         FWLOG 5,nRet

         AADD( aResult, UPPER( TRIM( buf ) ) )
      NEXT

      // 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

      FreeLibrary( nDLL )
      //
*   ELSE
*      MsgInfo( "need Everything32.dll !" + CRLF + ;
*               "you can get it at" + CRLF + ;
*               "http://www.voidtools.com/" )
*   ENDIF

RETURN ACLONE(aItems)

! Note : have add ""UTF8" .or. .T." while ANSI Version crash
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Everything under Fivewin

Postby Antonio Linares » Sun Nov 13, 2022 8:08 pm

Dear Jimmy,

function DllCall() is a Harbour function not a FWH one

Here you have good examples about how to use Harbour's DLL management functions:
https://github.com/FiveTechSoft/mod_harbour/blob/master/samples/mysql.prg
regards, saludos

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

Re: Everything under Fivewin

Postby Jimmy » Mon Nov 14, 2022 11:28 am

hi,

i have build these DLL FUNCTION for Everything32.DLL (32 Bit)

Code: Select all  Expand view  RUN
DLL FUNCTION Everything_SetSearchW(cText AS LPSTR )      AS VOID PASCAL LIB "Everything32.dll"
DLL FUNCTION Everything_SetSearchA(cText AS LPSTR )      AS VOID PASCAL LIB "Everything32.dll"
DLL FUNCTION Everything_SetRequestFlags(nFlag AS DWORD ) AS VOID PASCAL LIB "Everything32.dll"
DLL FUNCTION Everything_SetSort(nFlag AS DWORD )         AS VOID PASCAL LIB "Everything32.dll"
DLL FUNCTION Everything_QueryW(lBool AS BOOL )           AS BOOL PASCAL LIB "Everything32.dll"
DLL FUNCTION Everything_QueryA(lBool AS BOOL )           AS BOOL PASCAL LIB "Everything32.dll"
DLL FUNCTION Everything_GetNumResults()                  AS DWORD PASCAL LIB "Everything32.dll"
DLL FUNCTION Everything_GetResultFullPathNameW(nNum AS _INT, cBuffer AS LPSTR, nSize AS _INT ) AS VOID PASCAL LIB "Everything32.dll"
DLL FUNCTION Everything_GetResultFullPathNameA(nNum AS _INT, cBuffer AS LPSTR, nSize AS _INT ) AS VOID PASCAL LIB "Everything32.dll"


and want to run this Sample

Code: Select all  Expand view  RUN
TCHAR buf[MAX_PATH];
// set the search text to abc AND 123
Everything_SetSearch("abc 123");
// execute the query
Everything_Query(TRUE);
// get the number of visible file and folder results.
DWORD dwNumResults = Everything_GetNumResults();
// Get the full path and file name of the first visible result.
Everything_GetResultFullPathName(0,buf,sizeof(buf) / sizeof(TCHAR));


here my Fivewin CODE (Unicode / ANSI)
Code: Select all  Expand view  RUN
  MsgInfo( VAR2CHAR(DOEveryThing( "TGRID.*" ) ) )

FUNCTION DOEveryThing( cMask )
   nRet := Everything_SetSearchW(cMask )
*   nRet := Everything_SetSearchA(cMask )
   nRet := Everything_QueryW(FALSE)
*   nRet := Everything_QueryA( FALSE )
   nNum := Everything_GetNumResults()

CODE does run but nNum is 0 :( no Result

i guess some Parameter Type are still wrong for DLL FUNCTION ... have no experience with Type PASCAL
who can help me please

Everything_SetSearchW()
Syntax
void Everything_SetSearch(LPCTSTR lpString);
Parameters
lpString [in]
Pointer to a null-terminated string to be used as the new search text.
Return Value
This function has no return value.


Everything_QueryW()
Syntax
void Everything_Query( BOOL bWait);
Parameters
bWait
Should the function wait for the results or return immediately.

Set this to FALSE to post the IPC Query and return immediately.
Set this to TRUE to send the IPC Query and wait for the results.

Return Value
If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE. To get extended error information, call Everything_GetLastError


Everything_GetNumResults()
Syntax
DWORD Everything_GetNumResults(void);
Parameters
This functions has no parameters.
Return Value
Returns the number of visible file and folder results.

If the function fails the return value is 0. To get extended error information, call Everything_GetLastError


Everything_GetResultFullPathNameW()
Syntax
DWORD Everything_GetResultFullPathName( DWORD index, LPTSTR lpString, DWORD nMaxCount);
Parameters
index
Zero based index of the visible result.

lpString [out]
Pointer to the buffer that will receive the text. If the string is as long or longer than the buffer, the string is truncated and terminated with a NULL character.

nMaxCount

Specifies the maximum number of characters to copy to the buffer, including the NULL character. If the text exceeds this limit, it is truncated.

Return Value
If lpString is NULL, the return value is the number of TCHARs excluding the null terminator needed to store the full path and file name of the visible result.

If lpString is not NULL, the return value is the number of TCHARs excluding the null terminator copied into lpString.

If the function fails the return value is 0. To get extended error information, call Everything_GetLastError.
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Everything under Fivewin

Postby Antonio Linares » Mon Nov 14, 2022 1:04 pm

Dear Jimmy,

can you please send me Everything32.dll ?

many thanks
regards, saludos

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

Re: Everything under Fivewin

Postby Antonio Linares » Mon Nov 14, 2022 1:05 pm

You could call Everything_GetLastError() to check what it returns
regards, saludos

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

Re: Everything under Fivewin

Postby Jimmy » Mon Nov 14, 2022 1:49 pm

hi Antonio,

you can download Everything here
https://www.voidtools.com/

also look under
https://www.voidtools.com/downloads/
for Download Everything SDK
Everything-SDK.zip

and also
Download Everything Offline Help
Everything.chm.zip


---

What is Everything :

it does search for Filename, include "*" and "?", in own (RAM) Database "on-fly"
it does NOT "know" what is "inside" like Windows Search.

you can replace Windows search Taskbar with Everything Taskbar (add.on Tool, normal Tasktray)
you can use Everything DLL (32/64) Bit with your App
Image

Tip : as it also support Attribute of Files i use "A" to create a List for Backup (ShFileOperation)
Image
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Everything under Fivewin

Postby nageswaragunupudi » Mon Nov 14, 2022 9:51 pm

Good.
It is like our (x)Harbour function DIRECTORYRECURSE()

Code: Select all  Expand view  RUN
XBROWSER DIRECTORYRECURSE( "c:\fwh\*dll*.prg" ) SHOW RECID


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Everything under Fivewin

Postby Jimmy » Tue Nov 15, 2022 4:11 am

hi,
nageswaragunupudi wrote:It is like our (x)Harbour function DIRECTORYRECURSE()


can DIRECTORYRECURSE use ALL Drives to search :?:
does DIRECTORYRECURSE will "update" when "add"/"delete" Files :?:

the Speed is about T-Lizzi vs. SpaceX-Rocket
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Everything under Fivewin

Postby Jimmy » Mon Nov 21, 2022 8:51 am

hi,

still try to use Everything32.DLL but fail ...

as i understand i have to use DLL32 FUNCTION for Fivewin
Code: Select all  Expand view  RUN
DLL32 FUNCTION cFuncName( xParameter AS xType) AS xReturnValue PASCAL FROM "APIfunction" LIB "MyDLL.DLL"

but it fail with this
Code: Select all  Expand view  RUN
  nDll := LoadLib("Everything32.dll")

DLL32 FUNCTION LoadLib(lpFilename AS LPSTR) AS LONG PASCAL FROM "LoadLibrary" LIB "KERNEL32.DLL"

who can help me please with 1st Step
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Everything under Fivewin

Postby Antonio Linares » Mon Nov 21, 2022 9:45 am

Dear Jimmy,

Please try this and let me know what you get:

MsgInfo( LoadLibrary( "Everything32.dll" ) )

Don't use your LoadLibrary() implementation. FWH provides it.
regards, saludos

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

Re: Everything under Fivewin

Postby Antonio Linares » Mon Nov 21, 2022 9:51 am

I just tested this and worked fine:
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

   MsgInfo( LoadLibrary( "everything32.dll" ) )

return nil

It shows a valid handle
regards, saludos

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

Re: Everything under Fivewin

Postby Antonio Linares » Mon Nov 21, 2022 9:56 am

This code is also working fine:
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

   MsgInfo( Everything_GetBuildNumber() )

return nil

DLL FUNCTION Everything_GetBuildNumber() AS LONG PASCAL FROM "Everything_GetBuildNumber" LIB "everything32.dll"

It shows 1022
regards, saludos

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

Re: Everything under Fivewin

Postby Antonio Linares » Mon Nov 21, 2022 10:10 am

Dear Jimmy,

This code seem to work fine but it is also returning zero where it should returns 1 as such folder exists in my pc:
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

static hDLL

function Main()

   hDll = LoadLibrary( "everything32.dll" )

   MsgInfo( Everything_GetBuildNumber() )

   Everything_SetSearchA( "c:\fwteam" )

   MsgInfo( Everything_QueryA( .T. ) )

   MsgInfo( Everything_GetNumResults() )

   FreeLibrary( hDll )

   MsgInfo( "ok" )

return nil

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
regards, saludos

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

Re: Everything under Fivewin

Postby Antonio Linares » Mon Nov 21, 2022 10:31 am

There are a Everything_RebuildDB() and Everything_SaveDB() functions in everything32.dll

Maybe a database has to be created in advance ?
regards, saludos

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

Re: Everything under Fivewin

Postby Jimmy » Mon Nov 21, 2022 11:57 am

hi Antonio,

i have use you Sample and try to include missing Part but my DLL Function crash with Everything_SetRequestFlags()
Code: Select all  Expand view  RUN
#include "FiveWin.ch"
#include "EVERY.CH"
static hDLL

function Main()
LOCAL n, nNum, buf, nRet, bufsize := 250
LOCAL aResult := {}
   hDll = LoadLibrary( "everything32.dll" )
   MsgInfo( Everything_GetBuildNumber() )
   Everything_SetSearchA( "DUAL*.PRG" )
// crash here
   Everything_SetRequestFlags( nOr( EVERYTHING_REQUEST_PATH, EVERYTHING_REQUEST_FILE_NAME, EVERYTHING_REQUEST_SIZE ) )

   MsgInfo( Everything_QueryA( .T. ) )
   MsgInfo( Everything_GetNumResults() )

   nNum := Everything_GetNumResults()
   FOR n := 1 TO nNum
      buf := SPACE( bufsize )
      nRet := Everything_GetResultFullPathNameA( n, @buf, bufsize )
      AADD( aResult, UPPER( TRIM( buf ) ) )
? TRIM( buf )
   NEXT

   FreeLibrary( hDll )
   MsgInfo( "ok" )

return nil

can you please have a look at my DLL Function Everything_SetRequestFlags() why it crash :?:
Everything_GetResultFullPathNameA() seems to work and give Result for DUAL*.PRG :D

Code: Select all  Expand view  RUN
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

DLL FUNCTION Everything_SetRequestFlags( nFlag AS DWORD ) AS VOID PASCAL FROM "Everything_SetSearchA" LIB hDll
DLL FUNCTION Everything_GetResultFullPathNameA( nNum AS _INT, cBuffer AS LPSTR, nSize AS _INT ) AS VOID PASCAL FROM "Everything_GetResultFullPathNameA" LIB hDll

Code: Select all  Expand view  RUN
#define EVERYTHING_OK                     0 // no error detected
#define EVERYTHING_ERROR_MEMORY           1 // out of memory.
#define EVERYTHING_ERROR_IPC              2 // Everything search client is not running
#define EVERYTHING_ERROR_REGISTERCLASSEX  3 // unable to register window class.
#define EVERYTHING_ERROR_CREATEWINDOW     4 // unable to create listening window
#define EVERYTHING_ERROR_CREATETHREAD     5 // unable to create listening thread
#define EVERYTHING_ERROR_INVALIDINDEX     6 // invalid index
#define EVERYTHING_ERROR_INVALIDCALL      7 // invalid call
#define EVERYTHING_ERROR_INVALIDREQUEST   8 // invalid request data, request data first.
#define EVERYTHING_ERROR_INVALIDPARAMETER 9 // bad parameter.

#define EVERYTHING_SORT_NAME_ASCENDING                   1
#define EVERYTHING_SORT_NAME_DESCENDING                  2
#define EVERYTHING_SORT_PATH_ASCENDING                   3
#define EVERYTHING_SORT_PATH_DESCENDING                  4
#define EVERYTHING_SORT_SIZE_ASCENDING                   5
#define EVERYTHING_SORT_SIZE_DESCENDING                  6
#define EVERYTHING_SORT_EXTENSION_ASCENDING              7
#define EVERYTHING_SORT_EXTENSION_DESCENDING             8
#define EVERYTHING_SORT_TYPE_NAME_ASCENDING              9
#define EVERYTHING_SORT_TYPE_NAME_DESCENDING             10
#define EVERYTHING_SORT_DATE_CREATED_ASCENDING           11
#define EVERYTHING_SORT_DATE_CREATED_DESCENDING          12
#define EVERYTHING_SORT_DATE_MODIFIED_ASCENDING          13
#define EVERYTHING_SORT_DATE_MODIFIED_DESCENDING         14
#define EVERYTHING_SORT_ATTRIBUTES_ASCENDING             15
#define EVERYTHING_SORT_ATTRIBUTES_DESCENDING            16
#define EVERYTHING_SORT_FILE_LIST_FILENAME_ASCENDING     17
#define EVERYTHING_SORT_FILE_LIST_FILENAME_DESCENDING    18
#define EVERYTHING_SORT_RUN_COUNT_ASCENDING              19
#define EVERYTHING_SORT_RUN_COUNT_DESCENDING             20
#define EVERYTHING_SORT_DATE_RECENTLY_CHANGED_ASCENDING  21
#define EVERYTHING_SORT_DATE_RECENTLY_CHANGED_DESCENDING 22
#define EVERYTHING_SORT_DATE_ACCESSED_ASCENDING          23
#define EVERYTHING_SORT_DATE_ACCESSED_DESCENDING         24
#define EVERYTHING_SORT_DATE_RUN_ASCENDING               25
#define EVERYTHING_SORT_DATE_RUN_DESCENDING              26

#define EVERYTHING_REQUEST_FILE_NAME                     0x00000001
#define EVERYTHING_REQUEST_PATH                          0x00000002
#define EVERYTHING_REQUEST_FULL_PATH_AND_FILE_NAME       0x00000004
#define EVERYTHING_REQUEST_EXTENSION                     0x00000008
#define EVERYTHING_REQUEST_SIZE                          0x00000010
#define EVERYTHING_REQUEST_DATE_CREATED                  0x00000020
#define EVERYTHING_REQUEST_DATE_MODIFIED                 0x00000040
#define EVERYTHING_REQUEST_DATE_ACCESSED                 0x00000080
#define EVERYTHING_REQUEST_ATTRIBUTES                    0x00000100
#define EVERYTHING_REQUEST_FILE_LIST_FILE_NAME           0x00000200
#define EVERYTHING_REQUEST_RUN_COUNT                     0x00000400
#define EVERYTHING_REQUEST_DATE_RUN                      0x00000800
#define EVERYTHING_REQUEST_DATE_RECENTLY_CHANGED         0x00001000
#define EVERYTHING_REQUEST_HIGHLIGHTED_FILE_NAME         0x00002000
#define EVERYTHING_REQUEST_HIGHLIGHTED_PATH              0x00004000
#define EVERYTHING_REQUEST_HIGHLIGHTED_FULL_PATH_AND_FILE_NAME 0x00008000

#define EVERYTHING_TARGET_MACHINE_X86                 1
#define EVERYTHING_TARGET_MACHINE_X64                 2
#define EVERYTHING_TARGET_MACHINE_ARM                 3


p.s. Everything search for Files NOT Folder and no Path is need
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 57 guests