View RSS Feed

Development Team Blog

  1. AddressOf() does/did not work as expected with String[]

    by , 15-Mar-2010 at 09:00 AM (Development Team Blog)
    A while ago I received a question about why the following code is not working as expected:

    [code]
    String[] listData
    ...
    Move (SendMessage(hWnd, LB_ADDSTRING, 0, AddressOf(listData[iIndex]))) to iRetval
    [/code]

    It's a little tricky, but the code is expecting a pointer to a null terminated C-style string. And usually [I]AddressOf()[/I] will produce that with a local string variable. But in this case [I]AddressOf()[/I] actually returns a pointer ...