Page 1 of 1

[No Bug] 6.11 B3 won't compile same code as 6.10

Posted: Sun May 26, 2024 12:25 pm
by BarryG
This doesn't compile in 6.11 B3 but does with 6.10:

Code: Select all

Global folderlist$

Procedure GetAllOpenFolderPathsProc(hWnd,lParam) ; https://www.purebasic.fr/english/viewtopic.php?t=84380
  Static NewMap hWnd()
  If Not FindMapElement(hWnd(),Str(hWnd))
    GetWindowThreadProcessId_(hWnd,@PID)
    cap$=Space(999) : GetWindowText_(hWnd,@cap$,990)
    cl$=Space(999) : GetClassName_(hWnd,@cl$,990)
    If FindString(cap$,"Address: ") And cl$="ToolbarWindow32" ; Win 10 and lower (due to no tabbed folders).
      folderlist$+Mid(cap$,10)+#LF$
    ElseIf cl$="ShellTabWindowClass" ; Win 11 folder NAMES only, because Win 11 doesn't have an "Address: " field for folder paths. :(
      folderlist$+cap$+#LF$
    EndIf
    hWnd(Str(hWnd)) ; <- SYNTAX ERROR ON 6.11 B3 but not on 6.10
  EndIf
  EnumChildWindows_(hWnd,@GetAllOpenFolderPathsProc(),lParam+1)
  ProcedureReturn #True
EndProcedure

Procedure.s GetAllOpenFolderPaths() ; Win 10 or lower only due to not have tabbed folders.
  folderlist$=""
  EnumChildWindows_(GetDesktopWindow_(),@GetAllOpenFolderPathsProc(),0)
  ProcedureReturn folderlist$
EndProcedure

GetAllOpenFolderPaths()

Re: 6.11 B3 won't compile same code as 6.10

Posted: Sun May 26, 2024 12:36 pm
by STARGÅTE
It is no bug in 6.11, it was a bug in 6.10 and before:
[Done] PB6.03b9 Possible bug in array usage?

What should hWnd(Str(hWnd)) do? There is no assignment, therefore in invalid syntax.
If you want du add a map element without a value, you can use AddMapElement(hWnd(), Str(hWnd))

Re: 6.11 B3 won't compile same code as 6.10

Posted: Sun May 26, 2024 12:40 pm
by mk-soft
New syntax check.
It is no longer allowed to use without put value or get value.

Code: Select all

Global NewMap mymap()
Global NewList mylist()
Global Dim a(1)

AddElement(mylist())

mymap("100")
mylist()
a(0)

Re: 6.11 B3 won't compile same code as 6.10

Posted: Sun May 26, 2024 12:40 pm
by BarryG
STARGÅTE wrote: Sun May 26, 2024 12:36 pmWhat should hWnd(Str(hWnd)) do?
I don't know, I got the code from someone else. I'll amend it, then. Thanks!

@mk-soft: Thanks for explaining, too. :)