Dear Otto,
Using dynamic linking:
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local cFileName := Space( 50 )
/*
UINT GetTempFileNameA(
[in] LPCSTR lpPathName,
[in] LPCSTR lpPrefixString,
[in] UINT uUnique,
[out] LPSTR lpTempFileName
);
*/
GetTmpFileName( 'c:\fwh\samples', "ABC", 0, @cFileName )
MsgInfo( cFileName )
return nil
DLL32 Function GetTmpFileName( lpszPath AS LPSTR, lpPrefixString AS LPSTR, nUnique AS LONG, @lpTempFileName AS LPSTR ) AS LONG PASCAL ;
FROM "GetTempFileNameA" LIB "kernel32.dll"
Using static linking: (in this case we directly return the created name)
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local cFileName := Space( 50 )
/*
UINT GetTempFileNameA(
[in] LPCSTR lpPathName,
[in] LPCSTR lpPrefixString,
[in] UINT uUnique,
[out] LPSTR lpTempFileName
);
*/
? GetTmpFileName( 'c:\fwh\samples', "ABC", 0, @cFileName )
return nil
// DLL32 Function GetTmpFileName( lpszPath AS LPSTR, lpPrefixString AS LPSTR, nUnique AS LONG, @lpTempFileName AS LPSTR ) AS LONG PASCAL ;
// FROM "GetTempFileNameA" LIB "kernel32.dll"
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
HB_FUNC( GETTMPFILENAME )
{
char * cFileName = ( char * ) hb_xgrab( 50 );
GetTempFileNameA( hb_parc( 1 ), hb_parc( 2 ), hb_parnl( 3 ), cFileName );
hb_retc( cFileName );
hb_xfree( cFileName );
}
#pragma ENDDUMP