Показать сообщение отдельно
Старый 02.02.2009, 15:01   #5  
petergunn is offline
petergunn
Участник
 
118 / 274 (10) ++++++
Регистрация: 30.08.2005
Адрес: Tyumen
-> Пример. DAX 4.0
X++:
static void jbGetFullPathName(Args _args)
{
    #define.KernelDLL('KERNEL32')
    #define.offset0(0)
    
    str getFullPathName( fileName _fileName )
    {
        #define.BufferSize(2048)
        
        DLL         winApiDll = new DLL( #KernelDLL ) ;
        DLLFunction functionGetFullPathName = new DLLFunction( winApiDll, 'GetFullPathNameW' ) ;
        Binary      retVal = new Binary( #BufferSize * 2 ) ;    //  for *W functions alloc x2 size
        ;

        functionGetFullPathName.returns(ExtTypes::DWord);
        functionGetFullPathName.arg(ExtTypes::WString,
                                    ExtTypes::DWord,
                                    ExtTypes::Pointer,
                                    ExtTypes::Pointer);

        if( functionGetFullPathName.call( _fileName, #BufferSize, retVal, null ) )
            return retVal.wString( #Offset0 ) ;
        
        return '';
    }
    ;
    
    info( getFullPathName( 'SampleFileName.txt' ) ) ;
}