not working

Just starting out? Need help? Post your questions and find answers here.
moricode
Enthusiast
Enthusiast
Posts: 162
Joined: Thu May 25, 2023 3:55 am

not working

Post by moricode »

Code: Select all

Working:

Txt$ = "ABC XYZ"

 DrawText_(hdc,@Txt$,-1,RC, Text_Align | #DT_NOPREFIX )
NOT Working:

Code: Select all

Not working:

Newlist T$()

Addelement(T$())
T$()="ABC XYZ"

 DrawText_(hdc,@T$(),-1,RC, Text_Align | #DT_NOPREFIX )

miso
Enthusiast
Enthusiast
Posts: 409
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: not working

Post by miso »

None of these examples (working or not) shows anything to me when I run them. Can't confirm.
If I output the results in a console window (as a short check), I see the addresses.
User avatar
NicTheQuick
Addict
Addict
Posts: 1503
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: not working

Post by NicTheQuick »

`@T$()` does not give you the pointer to the string but to the list element itself, so you can use it with `ChangeCurrentElement()` for example.
You can fix it like this:

Code: Select all

NewList T$()

AddElement(T$())
T$()="ABC XYZ"

Debug PeekS(PeekI(@T$()))
So first retrieve the pointer to the field that contains the string. And then you can use that pointer to with the Windows API.
But be aware that an unset string results in a null pointer as you can see here:

Code: Select all

NewList T$()

AddElement(T$())

Debug PeekI(@T$())
In case you want to use a structure with the LinkedList, it would look like this:

Code: Select all

Structure T
	s.s
EndStructure
NewList T.T()

AddElement(T())
T()\s = "ABC XYZ"

Debug PeekS(@T()\s)
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
NicTheQuick
Addict
Addict
Posts: 1503
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: not working

Post by NicTheQuick »

Oh, and please update the titel of this thread. "not working" is not very helpful.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Post Reply