Puede que ya haya una funcion propia de HMG que ya haga esto, si alguien sabe?
with the power of google translator
This function in C, compiled in HMG.3.0.28 perfectly, but does not work with later versions, I tried the 3.3.1 on, anyone knows that change, the problem is as far as my knowledge (I think) in hbapi.h.
You may already have a function that HMG own and do this, if anyone knows?
Code: Select all
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
#include "hbapiitm.h"
HB_FUNC(GETVOLUMEINFORMATION)
{
char *VolumeNameBuffer = (char *) hb_xgrab( MAX_PATH ) ;
DWORD VolumeSerialNumber ;
DWORD MaximumComponentLength ;
DWORD FileSystemFlags ;
char *FileSystemNameBuffer = (char *) hb_xgrab( MAX_PATH ) ;
BOOL bRet ;
bRet = GetVolumeInformation( ISNIL(1) ? NULL : (LPCTSTR) hb_parc(1) ,
(LPTSTR) VolumeNameBuffer,
MAX_PATH,
&VolumeSerialNumber,
&MaximumComponentLength,
&FileSystemFlags,
(LPTSTR)FileSystemNameBuffer,
MAX_PATH ) ;
if ( bRet )
{
if ( ISBYREF( 2 ) ) hb_storc ((char *) VolumeNameBuffer, 2 ) ;
if ( ISBYREF( 3 ) ) hb_stornl( (LONG) VolumeSerialNumber, 3 ) ;
if ( ISBYREF( 4 ) ) hb_stornl( (LONG) MaximumComponentLength, 4 ) ;
if ( ISBYREF( 5 ) ) hb_stornl( (LONG) FileSystemFlags, 5 ) ;
if ( ISBYREF( 6 ) ) hb_storc ((char *) FileSystemNameBuffer, 6 ) ;
}
hb_retl(bRet);
hb_xfree( VolumeNameBuffer );
hb_xfree( FileSystemNameBuffer );
}
#pragma ENDDUMP
Code: Select all
#include "hmg.ch"
Function Main
LOCAL cUni :="D:\"
LOCAL cVolName :="VOLUMEN DEL DISCO"
LOCAL nSerNum := 1
LOCAL nMaxName:= 1
LOCAL nFlags := 1
LOCAL cFATName:="TIPO DE FAT "
DEFINE WINDOW Win_1 ;
AT 0,0 ;
WIDTH 600 ;
HEIGHT 270 ;
TITLE 'Lectura del Numero de Serie de un Disco' ;
MAIN
GetVolumeInformation(cUni,@cVolName,@nSerNum,@nMaxName,@nFlags,@cFATName)
@ 030,120 LABEL Label_01 VALUE 'Unidad de disco: '+cUni WIDTH 600 HEIGHT 020 FONT "Arial" SIZE 10
@ 060,120 LABEL Label_02 VALUE 'Etiqueta de Volumen: '+cVolName WIDTH 600 HEIGHT 020 FONT "Arial" SIZE 10
@ 090,120 LABEL Label_03 VALUE 'Numero de Serie: '+STR(nSerNum) WIDTH 600 HEIGHT 020 FONT "Arial" SIZE 10
@ 120,120 LABEL Label_04 VALUE 'Maximo de caracteres del Nombre: '+STR(nMaxName) WIDTH 600 HEIGHT 020 FONT "Arial" SIZE 10
@ 150,120 LABEL Label_05 VALUE 'Numero de Banderas: '+STR(nFlags) WIDTH 600 HEIGHT 020 FONT "Arial" SIZE 10
@ 180,120 LABEL Label_06 VALUE 'Tipo de FAT: '+cFATName WIDTH 600 HEIGHT 020 FONT "Arial" SIZE 10
END WINDOW
ACTIVATE WINDOW Win_1
Return
*------------
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
#include "hbapiitm.h"
HB_FUNC(GETVOLUMEINFORMATION)
{
char *VolumeNameBuffer = (char *) hb_xgrab( MAX_PATH ) ;
DWORD VolumeSerialNumber ;
DWORD MaximumComponentLength ;
DWORD FileSystemFlags ;
char *FileSystemNameBuffer = (char *) hb_xgrab( MAX_PATH ) ;
BOOL bRet ;
bRet = GetVolumeInformation( ISNIL(1) ? NULL : (LPCTSTR) hb_parc(1) ,
(LPTSTR) VolumeNameBuffer,
MAX_PATH,
&VolumeSerialNumber,
&MaximumComponentLength,
&FileSystemFlags,
(LPTSTR)FileSystemNameBuffer,
MAX_PATH ) ;
if ( bRet )
{
if ( ISBYREF( 2 ) ) hb_storc ((char *) VolumeNameBuffer, 2 ) ;
if ( ISBYREF( 3 ) ) hb_stornl( (LONG) VolumeSerialNumber, 3 ) ;
if ( ISBYREF( 4 ) ) hb_stornl( (LONG) MaximumComponentLength, 4 ) ;
if ( ISBYREF( 5 ) ) hb_stornl( (LONG) FileSystemFlags, 5 ) ;
if ( ISBYREF( 6 ) ) hb_storc ((char *) FileSystemNameBuffer, 6 ) ;
}
hb_retl(bRet);
hb_xfree( VolumeNameBuffer );
hb_xfree( FileSystemNameBuffer );
}
#pragma ENDDUMP