Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

problem with pointers

michael_green
Beginner
392 Views
Hi,
I'm making my first attempt at using pointers and it's not going well. I'm trying to get a text string from a list view using the following:
type (T_LVITEM)item
-
-
case(WM_NOTIFY)
-
-
iret = SendMessage(hWndList,LVM_GETITEM,1,loc(item))
So far so good, item%psztext contains a value which I understand is:
pszText
Address of a null-terminated string containing the item text ....

But what do I do with it from here? I've been trying to equate psztext to a pointer associated with a text string, but if I declare the pointer thus:

character*80tstring
pointer(pstring,tstring)


I get an access violation, and if I do the following:

character*80, pointer:: pstring

whatever I do subsequently I get compiler errors. I realise I am doing something stupid here and I'd love to know what it is. Please can someone enlighten me. (Apologies if this message appears twice - I sent a very similar one 10 minutes ago and it seems to have vanished.)

Many thanks in advance,

Mike

0 Kudos
1 Reply
ahasan
Beginner
392 Views
I believe you want to create a character variable, (for example szText), then use the following to retrieve the text from the LV item or subitem:
! this assigns the address to where the LV item or subitem text is stored
item%pszText = loc(szText)
iret = SendMessage(hWndList, LVM_GETITEM, 0, loc(item))
After the Sendmessage() function is executed,the character variable szText will contain the character string for the LV item or subitem referenced.
0 Kudos
Reply