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

Just starting out? Need help? Post your questions and find answers here.
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

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

Post 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()
Last edited by BarryG on Sun May 26, 2024 12:44 pm, edited 2 times in total.
User avatar
STARGÅTE
Addict
Addict
Posts: 2260
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

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

Post 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))
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
mk-soft
Always Here
Always Here
Posts: 6320
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

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

Post 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)
Last edited by mk-soft on Sun May 26, 2024 12:42 pm, edited 1 time in total.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

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

Post 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. :)
Post Reply