|
Olá Eduardo, Meu nome é David e sou de Curitiba, tudo tranquilo? Vi que esta com dificuldades para trabalhar com ponteiros, é meio difícil mesmo no início mas depois fica bem mais fácil, tudo por que na verdade você precisa usar uma DLL do centura chamada strci20.dll (isto na versão CTD2000) mas pode ter outro nome em outras versões e nela estão as funções que trabalham com ponteiros. No arquivo anexo estão as funções da strci20.dll e também tem um pequeno exemplo de como trabalhar com a chamada do ponteiro e também o tratamento do retorno. É importante que sempre seja setar o tamanho do buffer antes das chamadas, caso contrário simplesmente ele não funciona. Qualquer dúvida pode entrar em contato. Abraço! David Salomão Eduardo Borges escreveu:
|
.head 0 + Application Description: Centura SQLWindows Standard Application
Template
.head 1 - Outline Version - 4.0.28
.head 1 + Design-time Settings
.data VIEWINFO
0000: 6F00000001000000 FFFF01000D004347 5458566965775374 6174650400010000
0020: 0000000000A50000 002C000000020000 0003000000FFFFFF FFFFFFFFFFFCFFFF
0040: FFE9FFFFFFFFFFFF FF000000007C0200 004D010000010000 0001000000010000
0060: 000F4170706C6963 6174696F6E497465 6D00000000
.enddata
.head 2 - Outline Window State: Normal
.head 2 + Outline Window Location and Size
.data VIEWINFO
0000: 6600040003002D00 0000000000000000 0000B71E5D0E0500 1D00FFFF4D61696E
0020: 0000000000000000 0000000000000000 0000003B00010000 00000000000000E9
0040: 1E800A00008600FF FF496E7465726E61 6C2046756E637469 6F6E730000000000
0060: 0000000000000000 0000000000003200 0100000000000000 0000E91E800A0000
0080: DF00FFFF56617269 61626C6573000000 0000000000000000 0000000000000000
00A0: 3000010000000000 00000000F51E100D 0000F400FFFF436C 6173736573000000
00C0: 0000000000000000 0000000000000000
.enddata
.data VIEWSIZE
0000: D000
.enddata
.head 3 - Left: -0.013"
.head 3 - Top: 0.0"
.head 3 - Width: 8.013"
.head 3 - Height: 4.969"
.head 2 + Options Box Location
.data VIEWINFO
0000: D4180909B80B1A00
.enddata
.data VIEWSIZE
0000: 0800
.enddata
.head 3 - Visible? No
.head 3 - Left: 4.15"
.head 3 - Top: 1.885"
.head 3 - Width: 3.8"
.head 3 - Height: 2.073"
.head 2 + Class Editor Location
.head 3 - Visible? No
.head 3 - Left: 0.575"
.head 3 - Top: 0.094"
.head 3 - Width: 5.063"
.head 3 - Height: 2.719"
.head 2 + Tool Palette Location
.head 3 - Visible? No
.head 3 - Left: 6.388"
.head 3 - Top: 0.729"
.head 2 - Fully Qualified External References? Yes
.head 2 - Reject Multiple Window Instances? No
.head 2 - Enable Runtime Checks Of External References? Yes
.head 2 - Use Release 4.0 Scope Rules? No
.head 1 - Libraries
.head 1 + Global Declarations
.head 2 + Window Defaults
.head 3 + Tool Bar
.head 4 - Display Style? Etched
.head 4 - Font Name: MS Sans Serif
.head 4 - Font Size: 8
.head 4 - Font Enhancement: System Default
.head 4 - Text Color: System Default
.head 4 - Background Color: System Default
.head 3 + Form Window
.head 4 - Display Style? Etched
.head 4 - Font Name: MS Sans Serif
.head 4 - Font Size: 8
.head 4 - Font Enhancement: System Default
.head 4 - Text Color: System Default
.head 4 - Background Color: System Default
.head 3 + Dialog Box
.head 4 - Display Style? Etched
.head 4 - Font Name: MS Sans Serif
.head 4 - Font Size: 8
.head 4 - Font Enhancement: System Default
.head 4 - Text Color: System Default
.head 4 - Background Color: System Default
.head 3 + Top Level Table Window
.head 4 - Font Name: MS Sans Serif
.head 4 - Font Size: 8
.head 4 - Font Enhancement: System Default
.head 4 - Text Color: System Default
.head 4 - Background Color: System Default
.head 3 + Data Field
.head 4 - Font Name: Use Parent
.head 4 - Font Size: Use Parent
.head 4 - Font Enhancement: Use Parent
.head 4 - Text Color: Use Parent
.head 4 - Background Color: Use Parent
.head 3 + Multiline Field
.head 4 - Font Name: Use Parent
.head 4 - Font Size: Use Parent
.head 4 - Font Enhancement: Use Parent
.head 4 - Text Color: Use Parent
.head 4 - Background Color: Use Parent
.head 3 + Spin Field
.head 4 - Font Name: Use Parent
.head 4 - Font Size: Use Parent
.head 4 - Font Enhancement: Use Parent
.head 4 - Text Color: Use Parent
.head 4 - Background Color: Use Parent
.head 3 + Background Text
.head 4 - Font Name: Use Parent
.head 4 - Font Size: Use Parent
.head 4 - Font Enhancement: Use Parent
.head 4 - Text Color: Use Parent
.head 4 - Background Color: Use Parent
.head 3 + Pushbutton
.head 4 - Font Name: Use Parent
.head 4 - Font Size: Use Parent
.head 4 - Font Enhancement: Use Parent
.head 3 + Radio Button
.head 4 - Font Name: Use Parent
.head 4 - Font Size: Use Parent
.head 4 - Font Enhancement: Use Parent
.head 4 - Text Color: Use Parent
.head 4 - Background Color: Use Parent
.head 3 + Check Box
.head 4 - Font Name: Use Parent
.head 4 - Font Size: Use Parent
.head 4 - Font Enhancement: Use Parent
.head 4 - Text Color: Use Parent
.head 4 - Background Color: Use Parent
.head 3 + Option Button
.head 4 - Font Name: Use Parent
.head 4 - Font Size: Use Parent
.head 4 - Font Enhancement: Use Parent
.head 3 + Group Box
.head 4 - Font Name: Use Parent
.head 4 - Font Size: Use Parent
.head 4 - Font Enhancement: Use Parent
.head 4 - Text Color: Use Parent
.head 4 - Background Color: Use Parent
.head 3 + Child Table Window
.head 4 - Font Name: Use Parent
.head 4 - Font Size: Use Parent
.head 4 - Font Enhancement: Use Parent
.head 4 - Text Color: Use Parent
.head 4 - Background Color: Use Parent
.head 3 + List Box
.head 4 - Font Name: Use Parent
.head 4 - Font Size: Use Parent
.head 4 - Font Enhancement: Use Parent
.head 4 - Text Color: Use Parent
.head 4 - Background Color: Use Parent
.head 3 + Combo Box
.head 4 - Font Name: Use Parent
.head 4 - Font Size: Use Parent
.head 4 - Font Enhancement: Use Parent
.head 4 - Text Color: Use Parent
.head 4 - Background Color: Use Parent
.head 3 + Line
.head 4 - Line Color: Use Parent
.head 3 + Frame
.head 4 - Border Color: Use Parent
.head 4 - Background Color: 3D Face Color
.head 3 + Picture
.head 4 - Border Color: Use Parent
.head 4 - Background Color: Use Parent
.head 2 + Formats
.head 3 - Number: 0'%'
.head 3 - Number: #0
.head 3 - Number: ###000
.head 3 - Number: ###000;'($'###000')'
.head 3 - Date/Time: hh:mm:ss AMPM
.head 3 - Date/Time: M/d/yy
.head 3 - Date/Time: MM-dd-yy
.head 3 - Date/Time: dd-MMM-yyyy
.head 3 - Date/Time: MMM d, yyyy
.head 3 - Date/Time: MMM d, yyyy hh:mm AMPM
.head 3 - Date/Time: MMMM d, yyyy hh:mm AMPM
.head 2 + External Functions
.head 3 + Library name: strci20.dll
.head 4 - ThreadSafe: No
.head 4 + Function: CStructGetByte
.head 5 - Description: Extract a byte from a buffer.
nResult = CStructGetByte( strBuffer, nOffset )
.head 5 - Export Ordinal: 1
.head 5 + Returns
.head 6 - Number: BYTE
.head 5 + Parameters
.head 6 - String: LPVOID
.head 6 - Number: LONG
.head 4 + Function: CStructGetInt
.head 5 - Description: Extract an integer from a buffer.
nResult = CStructGetInt( strBuffer, nOffset )
.head 5 - Export Ordinal: 5
.head 5 + Returns
.head 6 - Number: INT
.head 5 + Parameters
.head 6 - String: LPVOID
.head 6 - Number: LONG
.head 4 + Function: CStructGetWord
.head 5 - Description: Extract a word from a buffer.
nResult = CStructGetWord( strBuffer, nOffset )
.head 5 - Export Ordinal: 3
.head 5 + Returns
.head 6 - Number: WORD
.head 5 + Parameters
.head 6 - String: LPVOID
.head 6 - Number: LONG
.head 4 + Function: CStructGetLong
.head 5 - Description: Extract a long from a buffer.
nResult = CStructGetLong( strBuffer, nOffset )
.head 5 - Export Ordinal: 5
.head 5 + Returns
.head 6 - Number: LONG
.head 5 + Parameters
.head 6 - String: LPVOID
.head 6 - Number: LONG
.head 4 + Function: CStructGetFloat
.head 5 - Description: Extract a float from a buffer.
nResult = CStructGetFloat( strBuffer, nOffset )
.head 5 - Export Ordinal: 7
.head 5 + Returns
.head 6 - Number: FLOAT
.head 5 + Parameters
.head 6 - String: LPVOID
.head 6 - Number: LONG
.head 4 + Function: CStructGetDouble
.head 5 - Description: Extract a double from a buffer.
nResult = CStructGetDouble( strBuffer, nOffset )
.head 5 - Export Ordinal: 9
.head 5 + Returns
.head 6 - Number: DOUBLE
.head 5 + Parameters
.head 6 - String: LPVOID
.head 6 - Number: LONG
.head 4 + Function: CStructGetBFloat
.head 5 - Description: Extract a BFloat from a buffer and convert to double.
nResult = CStructGetBFloat( strBuffer, nOffset )
.head 5 - Export Ordinal: 21
.head 5 + Returns
.head 6 - Number: DOUBLE
.head 5 + Parameters
.head 6 - String: LPVOID
.head 6 - Number: LONG
.head 4 + Function: CStructGetString
.head 5 - Description: Extract a string from a buffer.
nLength = CStructGetString( strBuffer, nOffset, nMaxWidth, strExtract )
.head 5 - Export Ordinal: 11
.head 5 + Returns
.head 6 - Number: LONG
.head 5 + Parameters
.head 6 - String: LPVOID
.head 6 - Number: LONG
.head 6 - Number: LONG
.head 6 - Receive String: LPSTR
.head 4 + Function: CStructGetFarPointer
.head 5 - Description: Extract a far pointer from a buffer.
nFarPointer = CStructGetFarPointer( strBuffer, nOffset )
.head 5 - Export Ordinal: 17
.head 5 + Returns
.head 6 - Number: ULONG
.head 5 + Parameters
.head 6 - Receive String: LPVOID
.head 6 - Number: LONG
.head 4 + Function: CStructPutByte
.head 5 - Description: Insert a byte into a buffer.
bOK = CStructPutByte( strBuffer, nOffset, nInsert )
.head 5 - Export Ordinal: 2
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - Receive String: LPVOID
.head 6 - Number: LONG
.head 6 - Number: BYTE
.head 4 + Function: CStructPutInt
.head 5 - Description: Insert an integer into a buffer.
bOK = CStructPutInt( strBuffer, nOffset, nInsert )
.head 5 - Export Ordinal: 6
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - Receive String: LPVOID
.head 6 - Number: LONG
.head 6 - Number: INT
.head 4 + Function: CStructPutWord
.head 5 - Description: Insert a word into a buffer.
bOK = CStructPutWord( strBuffer, nOffset, nInsert )
.head 5 - Export Ordinal: 4
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - Receive String: LPVOID
.head 6 - Number: LONG
.head 6 - Number: WORD
.head 4 + Function: CStructPutLong
.head 5 - Description: Insert a long into a buffer.
bOK = CStructPutLong( strBuffer, nOffset, nInsert )
.head 5 - Export Ordinal: 6
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - Receive String: LPVOID
.head 6 - Number: LONG
.head 6 - Number: LONG
.head 4 + Function: CStructPutFloat
.head 5 - Description: Insert a byte into a buffer.
bOK = CStructPutFloat( strBuffer, nOffset, nInsert )
.head 5 - Export Ordinal: 8
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - Receive String: LPVOID
.head 6 - Number: LONG
.head 6 - Number: FLOAT
.head 4 + Function: CStructPutDouble
.head 5 - Description: Insert a double into a buffer.
bOK = CStructPutDouble( strBuffer, nOffset, nInsert )
.head 5 - Export Ordinal: 10
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - Receive String: LPVOID
.head 6 - Number: LONG
.head 6 - Number: DOUBLE
.head 4 + Function: CStructPutBFloat
.head 5 - Description: Convert double to BFloat and insert it into a buffer.
bOK = CStructPutBFloat( strBuffer, nOffset, nInsert )
.head 5 - Export Ordinal: 22
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - Receive String: LPVOID
.head 6 - Number: LONG
.head 6 - Number: DOUBLE
.head 4 + Function: CStructPutString
.head 5 - Description: Insert a string into a buffer.
bOK = CStructPutString( strBuffer, nOffset, nMaxWidth, strInsert )
.head 5 - Export Ordinal: 12
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - Receive String: LPVOID
.head 6 - Number: LONG
.head 6 - Number: LONG
.head 6 - String: LPSTR
.head 4 + Function: CStructPutFarPointer
.head 5 - Description: Insert a far pointer into a buffer.
bOK = CStructPutFarPointer( strBuffer, nOffset, nFarPointer )
.head 5 - Export Ordinal: 18
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - Receive String: LPVOID
.head 6 - Number: LONG
.head 6 - Number: LONG
.head 4 + Function: CStructCopyBuffer
.head 5 - Description: Copy data from one String to another.
bOK = CStructCopyBuffer( strDest, nDestOffset,
strSrc, nSrcOffset, nCopyLen )
.head 5 - Export Ordinal: 19
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - String: LPVOID
.head 6 - Number: LONG
.head 6 - String: LPVOID
.head 6 - Number: LONG
.head 6 - Number: LONG
.head 4 + Function: CStructAllocFarMem
.head 5 - Description: Allocate memory and return a far pointer.
nFarPointer = CStructAllocFarMem( nBytes )
.head 5 - Export Ordinal: 13
.head 5 + Returns
.head 6 - Number: ULONG
.head 5 + Parameters
.head 6 - Number: LONG
.head 4 + Function: CStructFreeFarMem
.head 5 - Description: Free memory allocated by CStructAllocFarMem.
bOK = CStructFreeFarMem( nFarPointer )
.head 5 - Export Ordinal: 14
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - Number: LONG
.head 4 + Function: CStructCopyToFarMem
.head 5 - Description: Copy data from far memory to a String.
bOK = CStructCopyToFarMem( nFarPointer, strData, nDataLen )
.head 5 - Export Ordinal: 15
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - Number: LONG
.head 6 - String: LPVOID
.head 6 - Number: LONG
.head 4 + Function: CStructCopyFromFarMem
.head 5 - Description: Copy from a String to far memory.
bOK = CStructCopyFromFarMem( nFarPointer, strData, nMaxLen )
.head 5 - Export Ordinal: 16
.head 5 + Returns
.head 6 - Boolean: BOOL
.head 5 + Parameters
.head 6 - Number: LONG
.head 6 - Receive String: LPVOID
.head 6 - Number: LONG
.head 2 + Constants
.data CCDATA
0000: 3000000000000000 0000000000000000 00000000
.enddata
.data CCSIZE
0000: 1400
.enddata
.head 3 - System
.head 3 - User
.head 3 - Enumerations
.head 2 - Resources
.head 2 - Variables
.head 2 - Internal Functions
.head 2 - Named Menus
.head 2 + Class Definitions
.head 3 + Functional Class: Ponteiro
.head 4 - Description:
.head 4 - Derived From
.head 4 - Class Variables
.head 4 - Instance Variables
.head 4 + Functions
.head 5 + Function: execucao
.head 6 - Description:
.head 6 - Returns
.head 6 - Parameters
.head 6 - Static Variables
.head 6 + Local variables
.head 7 - String: sBuffer
.head 7 - Number: n
.head 7 - Number: pPointer
.head 7 - String: sTemp
.head 6 + Actions
.head 7 - !
.head 7 - ! Aqui no exemplo vou trabalhar com um buffer de 1024 bytes mas
podem ser maior ou menor
.head 7 - !
.head 7 - ! Alocar o tamanho do buffer
.head 7 - Call SalStrSetBufferLength( sBuffer, 1024 )
.head 7 - ! Alocar o tamanho do ponteiro
.head 7 - Set pPointer = CStructAllocFarMem( 1024 )
.head 7 - Call CStructCopyToFarMem( pPointer, sBuffer, 1024 )
.head 7 - !
.head 7 - ! Chamada da função que retorna o ponteiro da estrutura
no e-mail você mandou assim: Call fteste( str1, str2, str3, num1)
porém se ela trabalha com um ponteiro você deverá enviar somente o ponteiro e
no ponteiro você monta a estrutura
.head 7 - Call fteste( pPointer )
.head 7 - !
.head 7 - ! copia o conteúdo do ponteiro para o buffer onde você vai trabalhar
.head 7 - Call SalStrSetBufferLength( sBuffer, 1024 )
.head 7 - Call CStructCopyFromFarMem( pPointer, sBuffer, 1024 )
.head 7 - !
.head 7 - !
.head 7 - Call SalStrSetBufferLength( sTemp, 212 )
.head 7 - !
.head 7 - ! Aqui vou pegar um dado do tipo string que esta dentro do meu
ponteiro na posição 44 a 255
.head 7 - Call CStructGetString( sBuffer, 44, 255, sTemp )
.head 7 - !
.head 7 - ! Aqui vou pegar um dado do tipo Long que esta dentro do meu
ponteiro na posição 32
.head 7 - Set n = CStructGetLong( sBuffer, 32 )
.head 2 + Default Classes
.head 3 - MDI Window: cBaseMDI
.head 3 - Form Window:
.head 3 - Dialog Box:
.head 3 - Table Window:
.head 3 - Quest Window:
.head 3 - Data Field:
.head 3 - Spin Field:
.head 3 - Multiline Field:
.head 3 - Pushbutton:
.head 3 - Radio Button:
.head 3 - Option Button:
.head 3 - Check Box:
.head 3 - Child Table:
.head 3 - Quest Child Window: cQuickDatabase
.head 3 - List Box:
.head 3 - Combo Box:
.head 3 - Picture:
.head 3 - Vertical Scroll Bar:
.head 3 - Horizontal Scroll Bar:
.head 3 - Column:
.head 3 - Background Text:
.head 3 - Group Box:
.head 3 - Line:
.head 3 - Frame:
.head 3 - Custom Control:
.head 3 - ActiveX:
.head 2 - Application Actions


