SHOWFILEPROPERTIES -> TAB Detail -> MultiMedia Info

SHOWFILEPROPERTIES -> TAB Detail -> MultiMedia Info

Postby Jimmy » Sat Dec 17, 2022 12:58 pm

hi,

i can show Property of File like "FILEVERSION"
Image

now when have Multi-Media File i got "more" Information ...
Image
but how to "get" these Information :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: SHOWFILEPROPERTIES -> TAB Detail -> MultiMedia Info

Postby Jimmy » Sat Dec 17, 2022 1:14 pm

hi,

have ask ChatGPT :wink:

Can you show me the code of a program written in the Harbour language that show video Property of SHELLEXECUTEINFO ?

Answer from ChatGPT
Code: Select all  Expand view
#include "hbapi.h"
#include "hbvm.h"
#include "hbstack.h"
#include "hbapiitm.h"
#include "shellapi.h"

HB_FUNC( SHELLEXECUTEINFO )
{
   SHELLEXECUTEINFO sei;
   PHB_ITEM pArray;
   PHB_ITEM pSubArray;
   PHB_ITEM pItem;
   int i;

   sei.cbSize = sizeof( SHELLEXECUTEINFO );
   sei.fMask = 0;
   sei.hwnd = 0;
   sei.lpVerb = NULL;
   sei.lpFile = NULL;
   sei.lpParameters = NULL;
   sei.lpDirectory = NULL;
   sei.nShow = 0;
   sei.hInstApp = 0;
   sei.lpIDList = NULL;
   sei.lpClass = NULL;
   sei.hkeyClass = 0;
   sei.dwHotKey = 0;
   sei.hIcon = 0;
   sei.hProcess = 0;

   pArray = hb_itemArrayNew( 13 );

   pSubArray = hb_itemArrayNew( 2 );
   hb_arraySetNI( pSubArray, 1, sei.cbSize );
   hb_arraySetNI( pSubArray, 2, sei.fMask );
   hb_arraySet( pArray, 1, pSubArray );

   pSubArray = hb_itemArrayNew( 2 );
   hb_arraySetNL( pSubArray, 1, ( LONG ) sei.hwnd );
   hb_arraySetC( pSubArray, 2, sei.lpVerb );
   hb_arraySet( pArray, 2, pSubArray );

   pSubArray = hb_itemArrayNew( 2 );
   hb_arraySetC( pSubArray, 1, sei.lpFile );
   hb_arraySetC( pSubArray, 2, sei.lpParameters );
   hb_arraySet( pArray, 3, pSubArray );

   pSubArray = hb_itemArrayNew( 2 );
   hb_arraySetC( pSubArray, 1, sei.lpDirectory );
   hb_arraySetNI( pSubArray, 2, sei.nShow );
   hb_arraySet( pArray, 4, pSubArray );

   pSubArray = hb_itemArrayNew( 2 );
   hb_arraySetNL( pSubArray, 1, ( LONG ) sei.hInstApp );
   hb_arraySetNL( pSubArray, 2, ( LONG ) sei.lpIDList );
   hb_arraySet( pArray, 5, pSubArray );

   pSubArray = hb_itemArrayNew( 2 );
   hb_arraySetC( pSubArray, 1, sei.lpClass );
   hb_arraySetNL( pSubArray, 2, ( LONG ) sei.hkeyClass );
   hb_arraySet( pArray, 6, pSubArray );

   pSubArray = hb_itemArrayNew( 2 );
   hb_arraySetNI( pSubArray, 1, sei.dwHotKey );
   hb_arraySetNL( pSubArray, 2, ( LONG ) sei.hIcon );
   hb_arraySet( pArray, 7, pSubArray );

   pSubArray = hb_itemArrayNew( 2 );
   hb_arraySetNL( pSubArray, 1, ( LONG ) sei.hProcess );
   hb_arraySetNI( pSubArray, 2, 0 );
   hb_arraySet( pArray, 8, pSubArray );

   pItem = hb_itemPutPtr( NULL, &sei );
   hb_arraySet( pArray, 9, pItem );
   hb_itemRelease( pItem );

   for( i = 10; i <= 13; i++ )
      hb_arraySetNI( pArray, i, 0 );

   hb_itemReturnRelease( pArray );
}

have not try (yet) if CODE can be compile ...
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: SHOWFILEPROPERTIES -> TAB Detail -> MultiMedia Info

Postby Antonio Linares » Sun Dec 18, 2022 10:32 am

Great! :-)
regards, saludos

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

Re: SHOWFILEPROPERTIES -> TAB Detail -> MultiMedia Info

Postby Baxajaun » Sun Dec 18, 2022 11:47 am

Please, could you improve it ?


Code: Select all  Expand view
#include "hbapi.h"
#include "hbvm.h"
#include "hbstack.h"
#include "hbapiitm.h"
#include "shellapi.h"

HB_FUNC( SHELLEXECUTEINFO )
{
   SHELLEXECUTEINFO sei;
   PHB_ITEM pArray;
   PHB_ITEM pItem;

   sei.cbSize = sizeof( SHELLEXECUTEINFO );
   sei.fMask = 0;
   sei.hwnd = 0;
   sei.lpVerb = NULL;
   sei.lpFile = NULL;
   sei.lpParameters = NULL;
   sei.lpDirectory = NULL;
   sei.nShow = 0;
   sei.hInstApp = 0;
   sei.lpIDList = NULL;
   sei.lpClass = NULL;
   sei.hkeyClass = 0;
   sei.dwHotKey = 0;
   sei.hIcon = 0;
   sei.hProcess = 0;

   // Create a new array to hold the property values
   pArray = hb_itemArrayNew( 16 );

   // Set the values of the properties in the array using the values from the SHELLEXECUTEINFO structure
   hb_arraySetNI( pArray, 1, sei.cbSize );
   hb_arraySetNI( pArray, 2, sei.fMask );
   hb_arraySetNL( pArray, 3, ( LONG ) sei.hwnd );
   hb_arraySetC( pArray, 4, sei.lpVerb );
   hb_arraySetC( pArray, 5, sei.lpFile );
   hb_arraySetC( pArray, 6, sei.lpParameters );
   hb_arraySetC( pArray, 7, sei.lpDirectory );
   hb_arraySetNI( pArray, 8, sei.nShow );
   hb_arraySetNL( pArray, 9, ( LONG ) sei.hInstApp );
   hb_arraySetNL( pArray, 10, ( LONG ) sei.lpIDList );
   hb_arraySetC( pArray, 11, sei.lpClass );
   hb_arraySetNL( pArray, 12, ( LONG ) sei.hkeyClass );
   hb_arraySetNI( pArray, 13, sei.dwHotKey );
   hb_arraySetNL( pArray, 14, ( LONG ) sei.hIcon );
   hb_arraySetNL( pArray, 15, ( LONG ) sei.hProcess );

   // Create a new item to hold the address of the SHELLEXECUTEINFO structure and set it in the array
   pItem = hb_itemPutPtr( NULL, &sei );
   hb_arraySet( pArray, 16, pItem );
   hb_itemRelease( pItem );

   // Return the array of property values
   hb_itemReturnRelease( pArray );
}
User avatar
Baxajaun
 
Posts: 968
Joined: Wed Oct 19, 2005 2:17 pm
Location: Gatika. Bizkaia

Re: SHOWFILEPROPERTIES -> TAB Detail -> MultiMedia Info

Postby Jimmy » Sun Dec 18, 2022 12:44 pm

hi Antonio,

CODE written by ChatGPT look fine
CODE by ChatGPT does compile fine

but Result does not make (much) Sense ...
Image
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: SHOWFILEPROPERTIES -> TAB Detail -> MultiMedia Info

Postby Antonio Linares » Mon Dec 19, 2022 9:38 am

The call to function ShellExecuteExA() is missing, please ask chatGPT again asking to include such call :-)

I just did it and this answer seems ok to me :-)
Code: Select all  Expand view
// Call the ShellExecuteExA function using the SHELLEXECUTEINFO structure
BOOL bResult = ShellExecuteExA( &sei );

// Set the result of the function call in the array
hb_arraySetL( pArray, 17, bResult );
regards, saludos

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

Re: SHOWFILEPROPERTIES -> TAB Detail -> MultiMedia Info

Postby Jimmy » Mon Dec 19, 2022 6:16 pm

hi Antonio,

i try
Can you show me the code of a program written in the Harbour language that show video Property of SHELLEXECUTEINFO which use ShellExecuteExA and return hb_arraySetL ?

and got
Code: Select all  Expand view
#include "hbapi.h"
#include "hbvm.h"
#include "shellapi.h"

HB_FUNC( SHELLEXECUTEINFO )
{
   SHELLEXECUTEINFO sei;
   sei.cbSize = sizeof( SHELLEXECUTEINFO );
   sei.fMask = SEE_MASK_NOCLOSEPROCESS;
   sei.hwnd = NULL;
   sei.lpVerb = NULL;
   sei.lpFile = ( LPCTSTR ) hb_parc( 1 );
   sei.lpParameters = ( LPCTSTR ) hb_parc( 2 );
   sei.lpDirectory = ( LPCTSTR ) hb_parc( 3 );
   sei.nShow = SW_SHOW;
   sei.hInstApp = NULL;
   sei.lpIDList = NULL;
   sei.lpClass = NULL;
   sei.hkeyClass = NULL;
   sei.dwHotKey = 0;
   sei.hIcon = NULL;
   sei.hProcess = NULL;

   if( ShellExecuteExA( &sei ) )
   {
      PHB_ITEM pArray = hb_itemArrayNew( 2 );
      hb_arraySetL( pArray, 1, TRUE );
      hb_arraySetNInt( pArray, 2, ( HB_MAXINT ) sei.hProcess );
      hb_itemReturnRelease( pArray );
   }
   else
   {
      PHB_ITEM pArray = hb_itemArrayNew( 2 );
      hb_arraySetL( pArray, 1, FALSE );
      hb_arraySetNInt( pArray, 2, 0 );
      hb_itemReturnRelease( pArray );
   }
}

it does compile and run ...
it does "open" Explorer Folder of File :? and show
Image

I just did it and this answer seems ok to me

"how" did you ask ChatGPT ... i would like to try it

---

i got this CODE which seems to do what i want
Code: Select all  Expand view
FUNCTION FileInfo(cPath, cFilename, nItem, cHDR)
/**********************************************/
LOCAL  objFolder
LOCAL  objFolderItem
LOCAL  cFileInfo
LOCAL  cHeaderInfo
Public objShell   := CreateObject("Shell.Application")

  objFolder         := objShell:Namespace(cPath)
  objFolderItem     := objFolder:ParseName(cFilename)
  cFileInfo         := objFolder:GetDetailsOf(objFolderItem, nItem)
  cHeaderInfo       := objFolder:GetDetailsOf(objFolder:Items, nItem)

IF cHDR == 'H'
   RETURN cHeaderInfo
ELSE
   RETURN cFileInfo
ENDIF

RETURN NIL

Code: Select all  Expand view
? 'H-HDR', FileInfo(cPath, aFiles [XX, F_NAME ] , 021, 'H') // TITLE
? 'F-HDR', FileInfo(cPath, aFiles [XX, F_NAME ] , 021, 'F') // TITLE
FOR YY = 1 TO LEN(aMusic_FileInfo) -1
   cTITLE2  := FileInfo(cPath, aFiles [ XX, F_NAME ], aMusic_FileInfo [ YY ], 'F')

Problem :
i need to "know Name" of Property
Code: Select all  Expand view
aMusic_Headers    := {}
AADD(aMusic_Headers, {001, 'Grootte  '} )
AADD(aMusic_Headers, {016, 'Genre    '} )
AADD(aMusic_Headers, {027, 'Time     '} )
AADD(aMusic_Headers, {015, 'Year     '} )
AADD(aMusic_Headers, {009, 'Type     '} )
AADD(aMusic_Headers, {011, 'Kind     '} )
AADD(aMusic_Headers, {013, 'Contr_art'} )
AADD(aMusic_Headers, {220, 'Composers'} )

but how to get "Name" :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: SHOWFILEPROPERTIES -> TAB Detail -> MultiMedia Info

Postby Antonio Linares » Mon Dec 19, 2022 6:28 pm

I just asked chatGPT this:
modify this code so it returns all the members of the structure:
and your code

the answer seems fine :-)
Code: Select all  Expand view
#include "hbapi.h"
#include "hbvm.h"
#include "shellapi.h"

HB_FUNC( SHELLEXECUTEINFO )
{
   SHELLEXECUTEINFO sei;
   sei.cbSize = sizeof( SHELLEXECUTEINFO );
   sei.fMask = SEE_MASK_NOCLOSEPROCESS;
   sei.hwnd = NULL;
   sei.lpVerb = NULL;
   sei.lpFile = ( LPCTSTR ) hb_parc( 1 );
   sei.lpParameters = ( LPCTSTR ) hb_parc( 2 );
   sei.lpDirectory = ( LPCTSTR ) hb_parc( 3 );
   sei.nShow = SW_SHOW;
   sei.hInstApp = NULL;
   sei.lpIDList = NULL;
   sei.lpClass = NULL;
   sei.hkeyClass = NULL;
   sei.dwHotKey = 0;
   sei.hIcon = NULL;
   sei.hProcess = NULL;

   if( ShellExecuteExA( &sei ) )
   {
      PHB_ITEM pArray = hb_itemArrayNew( 11 );
      hb_arraySetL( pArray, 1, TRUE );
      hb_arraySetNInt( pArray, 2, ( HB_MAXINT ) sei.hProcess );
      hb_arraySetNInt( pArray, 3, sei.cbSize );
      hb_arraySetNInt( pArray, 4, sei.fMask );
      hb_arraySetNInt( pArray, 5, ( HB_MAXINT ) sei.hwnd );
      hb_arraySetC( pArray, 6, sei.lpVerb );
      hb_arraySetC( pArray, 7, sei.lpFile );
      hb_arraySetC( pArray, 8, sei.lpParameters );
      hb_arraySetC( pArray, 9, sei.lpDirectory );
      hb_arraySetNInt( pArray, 10, sei.nShow );
      hb_arraySetNInt( pArray, 11, ( HB_MAXINT ) sei.hInstApp );
      hb_itemReturnRelease( pArray );
   }
   else
   {
      PHB_ITEM pArray = hb_itemArrayNew( 2 );
      hb_arraySetL( pArray, 1, FALSE );
      hb_arraySetNInt( pArray, 2, 0 );
      hb_itemReturnRelease( pArray );
   }
}
 
regards, saludos

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

Re: SHOWFILEPROPERTIES -> TAB Detail -> MultiMedia Info

Postby Jimmy » Mon Dec 19, 2022 8:00 pm

hi Antonio,
the answer seems fine

it will not compile on my PC ...
Code: Select all  Expand view
set FWDIR=c:\fwh
set fwh=c:\fwh
call c:\fwh\samples\buildh.bat HB_FUNC

Compiling '.\HB_FUNC.PRG'...
c:\harbour\include\hbdefs.h(50) Error F0029 Can't open #include file 'stdarg.h'
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: SHOWFILEPROPERTIES -> TAB Detail -> MultiMedia Info

Postby Jimmy » Mon Dec 19, 2022 11:22 pm

hi,

have try other Way using "Shell.Application" and GetDetailsOf()

Code: Select all  Expand view
FUNCTION GetMetaData(cPath, cFilename)
LOCAL aRet  := {}
LOCAL nItem ,iMax := 333
LOCAL cRet  := ""
LOCAL cRet2 := ""
LOCAL objShell := CreateObject("Shell.Application")

   FOR nItem := 1 TO iMax
      cRet2 := FileInfo(objShell,cPath, cFilename, nItem-1, "H")
      cRet  := FileInfo(objShell,cPath, cFilename, nItem-1, "F")

      IF !EMPTY(cRet2) .and. !EMPTY(cRet)
         AADD(aRet,{TRIM(VAR2CHAR(cRet2)), TRIM(VAR2CHAR(cRet))})
      ENDIF
   NEXT

   objShell := NIL

RETURN aRet

Code: Select all  Expand view
FUNCTION FileInfo(objShell,cPath, cFilename, nItem, cHDR)
LOCAL objFolder
LOCAL objFolderItem
LOCAL cFileInfo
LOCAL cHeaderInfo
LOCAL cRet

   objFolder         := objShell:Namespace(cPath)
   objFolderItem     := objFolder:ParseName(cFilename)
   cFileInfo         := objFolder:GetDetailsOf(objFolderItem, nItem)
   cHeaderInfo       := objFolder:GetDetailsOf(objFolder:Items, nItem)

   IF cHDR == 'H'
      cRet := cHeaderInfo
   ELSE
      cRet := cFileInfo
   ENDIF

RETURN cRet

this now give me a Meta Information like Explorer when add "extra" Column from Popup-Menu
Image
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: SHOWFILEPROPERTIES -> TAB Detail -> MultiMedia Info

Postby Antonio Linares » Tue Dec 20, 2022 7:29 am

very good :-)
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 84 guests