Transform a variable into a linkedlist
Posted: Sun Sep 02, 2007 12:36 am
Hi!, i am working to get the following:
"Specify as the lParam of EnumWindows_() a linkedlist so that on EnumWindowsProc() the windows' handle are added to that list."
I have been the last 2 hours searching on the forums trying do learn more about how pointers and linkedlists work together but i still haven't found a way to do this.
Maybe my approach is stupid and i can't see it? I'm feeling like i got everything i need like the address to the list i want, but the stop is on how to add elements to that address as i would simply if that was a normal linkedlist.
I know that, if the linkedlist was global i could simply work it out, but i want the linkedlist to be local to that procedure(EnumMyWindows()). Maybe this is the reason why i can't use it on EnumWindowsProc() ? - because MyWindowsList() is local to EnumMyWindows()?
(Regain breath)
Throw me some light on this if you can and, thanks for taking the time to read this anyway.
Regards,
xgp
"Specify as the lParam of EnumWindows_() a linkedlist so that on EnumWindowsProc() the windows' handle are added to that list."
Code: Select all
Procedure EnumWindowsProc(hWnd, DestinyList.l)
CallDebugger
Debug "DestinyList.l = "+Str(DestinyList.l)
; so, DestinyList = @MyWindowsList()
; How to add elements do MyWindowsList() from here?
ProcedureReturn 0 ; run this 1 time only
EndProcedure
Procedure EnumMyWindows()
Protected NewList MyWindowsList.l()
; add an element so i can use this list as
; a parameter, workaround?
AddElement(MyWindowsList())
MyWindowsList() = 15
Debug "Address of MyWindowsList() = "+Str(@MyWindowsList())
EnumWindows_(@EnumWindowsProc(), @MyWindowsList())
EndProcedure
EnumMyWindows()
Maybe my approach is stupid and i can't see it? I'm feeling like i got everything i need like the address to the list i want, but the stop is on how to add elements to that address as i would simply if that was a normal linkedlist.
I know that, if the linkedlist was global i could simply work it out, but i want the linkedlist to be local to that procedure(EnumMyWindows()). Maybe this is the reason why i can't use it on EnumWindowsProc() ? - because MyWindowsList() is local to EnumMyWindows()?
(Regain breath)
Throw me some light on this if you can and, thanks for taking the time to read this anyway.
Regards,
xgp