Announcement

Collapse
No announcement yet.

Simple SendMessage Question

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

  • Simple SendMessage Question

    Can someone kindly put me out of my misery with the following?
    I need to know how to perform the conversion of an LPSTR to a
    LPARAM:

    In C/C++ I'd do the following:

    SendMessage(hLbox, LB_ADDSTRING, 0, (LPARAM) "Test string")

    However in PB it gets upset with the LPARAM parameter. How do
    I go about performing an implicit cast?

    Andrew


    ------------------
    http://www.linkedin.com/in/andrewmckay

  • #2
    If you want to use a dynamic string:
    Code:
    DIM sText AS STRING
    sText = "Test string"
    SendMessage hLBox, %LB_ADDSTRING, 0, STRPTR(sText)
    If you want to use as ASCIIZ string:
    Code:
    DIM szText AS ASCIIZ * 256
    szText = "Test string"
    SendMessage hLBox, %LB_ADDSTRING, 0, VARPTR(szText)

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


    [This message has been edited by JOSE ROCA (edited March 10, 2003).]

    Comment


    • #3
      Thanks Jose! It was the StrPtr() function I was missing.

      Gosh, it's been some years since I had to pick up a new language
      and compiler

      Andrew


      ------------------
      http://www.linkedin.com/in/andrewmckay

      Comment

      Working...
      X