Chamando funções com nome longo de uma DLL

Fórum sobre a linguagem CA-Clipper.

Moderador: Moderadores

Avatar do usuário
bencz
Usuário Nível 4
Usuário Nível 4
Mensagens: 524
Registrado em: 28 Abr 2012 17:36
Contato:

Chamando funções com nome longo de uma DLL

Mensagem por bencz »

Bom dia!
Estou fazendo alguns experimentos e gostaria de saber se existe alguma maneira de chamar funções de uma DLL, usando o nome longo da função ?
Pergunto isto, pois o clipper tem aquela limitação de 8 caracteres e etc...

As funções da DLL começam com um nome único, por exemplo: "NomeDaClasseBaseDaFuncao_<nome da função>".
Obs: Estou usando o FW24 junto.
Imagem
Kapiaba
Colaborador
Colaborador
Mensagens: 1908
Registrado em: 07 Dez 2012 16:14
Localização: São Paulo
Contato:

Chamando funções com nome longo de uma DLL

Mensagem por Kapiaba »

Código: Selecionar todos

// Many thanks to Jim Gale for his superb feed-back

#include "FiveWin.ch"
#include "struct.ch"

//------------------------------------------------------------------------//

function Main()

   local cLongName := Space( 256 )
   local nNamePos  := 0
   local hFile

   lMkDir( "this is a long name directory" )

   LCreat( "this is a long filename file" )

   MsgInfo( GetFullPathName( "thisis~1", Len( cLongName ),;
                             @cLongName, @nNamePos ) )
   MsgInfo( cLongName )
   MsgInfo( nNamePos )   // this returns an invalid value

   MsgInfo( "LongName: " + GetLongFileName( "thisis~1" ) )

   hFile = FOpen( "tutor01.prg" )
   FCommit( hFile )
   FClose( hFile )

   MsgInfo( "ok" )

return nil

//------------------------------------------------------------------------//

function GetLongFileName( cShortName )

   local oWin32FindData

   STRUCT oWin32FindData
      MEMBER nFileAttributes  AS DWORD
      MEMBER nCreationTime    AS STRING LEN 8
      MEMBER nLastReadAccess  AS STRING LEN 8
      MEMBER nLastWriteAccess AS STRING LEN 8
      MEMBER nSizeHight       AS DWORD
      MEMBER nSizeLow         AS DWORD
      MEMBER nReserved0       AS DWORD
      MEMBER nReserved1       AS DWORD
      MEMBER cFileName        AS STRING LEN 260
      MEMBER cAltName         AS STRING LEN  14
   ENDSTRUCT

   FindFirstFile( cShortName, oWin32FindData:cBuffer )

return oWin32FindData:cFileName

//------------------------------------------------------------------------//

DLL32 Function GetFullPathName( lpszFile AS LPSTR, cchPath AS DWORD,;
               lpszPath AS LPSTR, @nFilePos AS PTR ) AS DWORD ;
               PASCAL FROM "GetFullPathNameA" LIB "kernel32.dll"

DLL32 FUNCTION FindFirstFile( cFile AS LPSTR, cWin32DataInfo AS LPSTR ) ;
               AS LONG PASCAL FROM "FindFirstFileA" LIB "kernel32.dll"

//------------------------------------------------------------------------//
Responder