getting string data from a structure. 
Author Message
 getting string data from a structure.

After all my work I now have the function call working to
lineGetCallInfo...  But now that I have all the data in the structure, how
the hell do I get it out!?!

The structure containes length and offset data for some strings that I need
to print out, but I cant't figure out how to get at the data...  I would
know how to do it if it were a string, but how do I get this struct into
string format?



Mon, 18 Dec 2000 03:00:00 GMT  
 getting string data from a structure.

A struct is a data type. It contains several members from diffirent data
types.

An examples

Type DataBaseInfoHeader
        cbSize As Integer
        nTables As Integer
        nFileSize As Integer
        sFileName As String
End Type

What if I had a function which reads a random file's header and fills the
members.

Dim dbHeader As DataBaseInfoHeader

dbHeader.cbSize = Len(dbHeader)

ReadDBHeader( dbHeader )

' Now the members
Dim sFileName As String
Dim nTables As Integer, nFileSize  As Integer

' Now read the info

sFileName = dbHeader.sFileName
nTables = dbHeader.nTables
nFileSize = dbHeader.nFileSize

So you can aproach the structure's data just like an objects properties.

Good Luck



Quote:
> After all my work I now have the function call working to
> lineGetCallInfo...  But now that I have all the data in the structure,
how
> the hell do I get it out!?!

> The structure containes length and offset data for some strings that I
need
> to print out, but I cant't figure out how to get at the data...  I would
> know how to do it if it were a string, but how do I get this struct into
> string format?



Tue, 19 Dec 2000 03:00:00 GMT  
 getting string data from a structure.

OK, that I know...  the problem is that all the members of this VARIABLE
LENGTH UDT are only the length of the data held, and its offset from the
front of the struct.  I will show you the struct below...

Type LINECALLINFO
    dwTotalSize As Long
    dwNeededSize As Long
    dwUsedSize As Long

    hLine As Long
    dwLineDeviceID As Long
    dwAddressID As Long

    dwBearerMode As Long
    dwRate As Long
    dwMediaMode As Long

    dwAppSpecific As Long
    dwCallID As Long
    dwRelatedCallID As Long
    dwCallParamFlags As Long
    dwCallStates As Long

    dwMonitorDigitModes As Long
    dwMonitorMediaModes As Long
    DialParams As LINEDIALPARAMS

    dwOrigin As Long
    dwReason As Long
    dwCompletionID As Long
    dwNumOwners As Long
    dwNumMonitors As Long

    dwCountryCode As Long
    dwTrunk As Long

    dwCallerIDFlags As Long
    dwCallerIDSize As Long
    dwCallerIDOffset As Long
    dwCallerIDNameSize As Long
    dwCallerIDNameOffset As Long

    dwCalledIDFlags As Long
    dwCalledIDSize As Long
    dwCalledIDOffset As Long
    dwCalledIDNameSize As Long
    dwCalledIDNameOffset As Long

    dwConnectedIDFlags As Long
    dwConnectedIDSize As Long
    dwConnectedIDOffset As Long
    dwConnectedIDNameSize As Long
    dwConnectedIDNameOffset As Long

    dwRedirectionIDFlags As Long
    dwRedirectionIDSize As Long
    dwRedirectionIDOffset As Long
    dwRedirectionIDNameSize As Long
    dwRedirectionIDNameOffset As Long

    dwRedirectingIDFlags As Long
    dwRedirectingIDSize As Long
    dwRedirectingIDOffset As Long
    dwRedirectingIDNameSize As Long
    dwRedirectingIDNameOffset As Long

    dwAppNameSize As Long
    dwAppNameOffset As Long

    dwDisplayableAddressSize As Long
    dwDisplayableAddressOffset As Long

    dwCalledPartySize As Long
    dwCalledPartyOffset As Long

    dwCommentSize As Long
    dwCommentOffset As Long

    dwDisplaySize As Long
    dwDisplayOffset As Long

    dwUserUserInfoSize As Long
    dwUserUserInfoOffset As Long

    dwHighLevelCompSize As Long
    dwHighLevelCompOffset As Long

    dwLowLevelCompSize As Long
    dwLowLevelCompOffset As Long

    dwChargingInfoSize As Long
    dwChargingInfoOffset As Long

    dwTerminalModesSize As Long
    dwTerminalModesOffset As Long

    dwDevSpecificSize As Long
    dwDevSpecificOffset As Long
End Type

ok... now the data I need is given by the dwDisplaySize and dwDisplayOffset
parts of this struct...  I know how to get at data this way when the entire
thing is encapsulated inside a string... but since VB does not do pointer
math, how do I pull out that character data when all I am given is the
offset and length of the data?  I have no way to start couting from the
starting address, and useing the offset in VB...

HELP!



Quote:
> A struct is a data type. It contains several members from diffirent data
> types.

> An examples

> Type DataBaseInfoHeader
>    cbSize As Integer
>    nTables As Integer
>    nFileSize As Integer
>    sFileName As String
> End Type

> What if I had a function which reads a random file's header and fills the
> members.

> Dim dbHeader As DataBaseInfoHeader

> dbHeader.cbSize = Len(dbHeader)

> ReadDBHeader( dbHeader )

> ' Now the members
> Dim sFileName As String
> Dim nTables As Integer, nFileSize  As Integer

> ' Now read the info

> sFileName = dbHeader.sFileName
> nTables = dbHeader.nTables
> nFileSize = dbHeader.nFileSize

> So you can aproach the structure's data just like an objects properties.

> Good Luck



> > After all my work I now have the function call working to
> > lineGetCallInfo...  But now that I have all the data in the structure,
> how
> > the hell do I get it out!?!

> > The structure containes length and offset data for some strings that I
> need
> > to print out, but I cant't figure out how to get at the data...  I
would
> > know how to do it if it were a string, but how do I get this struct
into
> > string format?



Fri, 22 Dec 2000 03:00:00 GMT  
 getting string data from a structure.


Fri, 19 Jun 1992 00:00:00 GMT  
 getting string data from a structure.

OK, here was the solution to my problem..  Because VB dose not do pointer
math at all I ahd to convert this struct into an array that I could parse
with the size and offset data to look for the info I wanted.

the CopyMemory function (Q129947 & Q171652 on the M$ KB) was enough to get
my structure packed into a BYTE array, then I could parse the array to look
for my data.  This worked like a charm for me except for a few minor data
formatting issues.

Thanks to this info, I can now use the Artisift Visual Voice controls to
capture digital display phone data from a VB program.

Yahoooooooooo!

Thanks to all how provided help on this matter.



Quote:
> OK, that I know...  the problem is that all the members of this VARIABLE
> LENGTH UDT are only the length of the data held, and its offset from the
> front of the struct.  I will show you the struct below...

> Type LINECALLINFO
>     dwTotalSize As Long
>     dwNeededSize As Long



Fri, 22 Dec 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Getting at data in structure returned as a long pointer (Win API)

2. copy data structure to string

3. Copying content of data structure into string

4. I'd use string methods more if string were a structure and not a class

5. ReadEventLog: Getting Strings, SID and Data

6. Getting hex data into and out of a string field

7. Updating Data in a Self Joined Many-to-Many Data Structure (Previous Post Omitted Text)

8. Copy Data Structures no data DB to DB

9. copy data structure and data

10. Help - Simply Getting Data from Extrenal Data Files (not from Access Data Base)

11. Getting Structure Information

12. Reflection: Getting fields in structure

 

 
Powered by phpBB® Forum Software