Announcement

Collapse
No announcement yet.

GetTextExtentPoint32

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    GetTextExtentPoint32

    The Windows API HELP states, in connection with GetTextExtentPoint32,
    that --

    lpString

    Points to the string of text. The string does not need to be zero-terminated, since cbString specifies the length of the string.

    This line of code works:

    Call GetTextExtentPoint32 (hDC&, tx$+Chr$(0), Len(tx$), apiSz)

    If the Chr$(0) is removed, PowerBasic reports a compile time error
    about "parameter mismatch". Anyone know of a reason for this?


    ------------------

    #2
    Dieny --
    the second parameter should be Asciiz.
    I guess that tx$ is declared as string.
    If so, you should use ByCopy tx$ or ByVal StrPtr(tx$)

    When you use a$ + b$, compiler converts according declaration automatic. That's why tx$ + CHR$(0) is accepted.



    ------------------

    Comment


      #3
      +++
      And you don't need to specify the Chr$( 0 )
      PB does that for you..

      Don't do: Text$ & Chr$( 0 )

      ------------------
      [email protected]
      hellobasic

      Comment


        #4
        Thank you, Semen and Edwin -- that works!


        ------------------

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎