Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 8 of 8

Thread: null terminated string

  1. #1
    New Member
    Join Date
    Apr 2002
    Location
    Australia
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    hello,
    i have the following delphi code in relation to a null terminated string
    LibName, TransBuff : Pchar
    LibName = StrAlloc (500)
    Transbuff = StrAlloc (970)

    could someone please tell me the relative vba code for variable type Pchar and function StrAlloc?
    regards

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Unless you find someone here who knows Delphi, you will need to give an indepth description of what that code is doing before you can get a decent answer.
    Explain the type Vchar
    Also the function StrAlloc
    Thanks,
    Tom

  3. #3
    MrExcel MVP
    Join Date
    Apr 2002
    Location
    Vancouver BC , Canada
    Posts
    6,259
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    So it's not only me that didn't understand what he was talking about !

  4. #4
    New Member
    Join Date
    Apr 2002
    Location
    Australia
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    hi there Tom,

    Pchar is an ANSI (8 bit) character.
    StrAlloc allocates a buffer for a null-terminated string and returns a pointer to its first character.

    Rgds

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    The only 8 bit data type in VB is the byte data type. This will only return a number from 0 to 255.
    I do not know what a null terminated string is, so I cannot really help you there.
    You may need to find someone who knows both languages.
    Tom

  6. #6
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I don't know if this helps, but, VBA has some constants:

    vbNullString
    vbNullChar

    there's another one that may be what you want

    vbNull
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  7. #7
    MrExcel MVP
    Colo's Avatar
    Join Date
    Mar 2002
    Location
    Kobe, Japan
    Posts
    1,456
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    2 Thread(s)

    Default

    Hi vvershas,

    I only know a little about Delphi.
    The character sequence type "String" used by Delphi is original with Delphi.
    A StrAlloc function secures a memory.
    So I GUESS only you have to do it with vba is

    Dim LibName As String * 500
    Dim Transbuff As String * 970

    May be.....but I think that I do not need to carry out such usage by VBA.
    Hope this helps + pen pineapple apple pen!

    Masaru Kaji aka Colo - cellmasters.net

  8. #8
    New Member
    Join Date
    Apr 2002
    Location
    Australia
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    hi Colo,

    that code has worked fine thanks!
    it does appear that Vb doesn't need specific code to do this.

    cheers
    Microsoft 1 Borland 0

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •