hi,
i can show Property of File like "FILEVERSION"
now when have Multi-Media File i got "more" Information ...
but how to "get" these Information
Can you show me the code of a program written in the Harbour language that show video Property of SHELLEXECUTEINFO ?
#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 );
}
Please, could you improve it ?
#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 );
}
// 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 );
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 ?
#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 );
}
}
I just did it and this answer seems ok to me
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
? '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')
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'} )
and your codemodify this code so it returns all the members of the structure:
#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 );
}
}
the answer seems fine
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'
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
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
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 56 guests