Page 1 of 1

Advanced Path Requester [Windows]

Posted: Fri Aug 18, 2023 8:23 pm
by RASHAD
For KCC :D
Simple and right to the required folder
Ascii or Unicode
PB x86 or x64

Code: Select all

#BIF_RETURNONLYFSDIRS = 1;
#BIF_DONTGOBELOWDOMAIN = 2;
#BIF_STATUSTEXT = 4;
#BIF_RETURNFSANCESTORS = 8;
#BIF_EDITBOX = 16;
#BIF_VALIDATE = 32;
#BIF_NEWDIALOGSTYLE = 64;
#BIF_BROWSEINCLUDEURLS = 128;
;#BIF_USENEWUI =  #BIF_EDITBOX | #BIF_NEWDIALOGSTYLE
#BIF_BROWSEFORCOMPUTER = $1000;
#BIF_BROWSEFORPRINTER = $2000;
#BIF_BROWSEINCLUDEFILES = $4000;
#BIF_SHAREABLE = $8000;
#BFFM_INITIALIZED = 1;
#BFFM_SELCHANGED = 2;
#BFFM_VALIDATEFAILEDA = 3;
#BFFM_VALIDATEFAILEDW = 4;
#BFFM_SETSTATUSTEXTA = #WM_USER + 100;
#BFFM_ENABLEOK = #WM_USER + 101;
#BFFM_SETSELECTIONA = #WM_USER + 102;
#BFFM_SETSELECTIONW = #WM_USER + 103;
#BFFM_SETSTATUSTEXTW = #WM_USER + 104;
#BFFM_SETOKTEXT = #WM_USER + 105;
#BFFM_SETEXPANDED = #WM_USER + 106

Global STYLE

CompilerIf #PB_Compiler_Unicode
    STYLE = #BFFM_SETSELECTIONW
CompilerElse
    STYLE = #BFFM_SETSELECTIONA
CompilerEndIf

Procedure PathCB(hWnd, uMsg, lParam, lData)
  Select uMsg
    Case #BFFM_INITIALIZED
      If lData
        SendMessage_ (hwnd, STYLE, 1, lData)
        Delay(100)
        PostMessage_ (hwnd, STYLE, 1, lData)
      EndIf
  EndSelect
EndProcedure

Procedure.S PathRequesterAPI( StatusText.S, Path.S)
  Folder.S = Space(#MAX_PATH)
  bi.BROWSEINFO
  bi\ulFlags =  #BIF_NONEWFOLDERBUTTON|#BIF_NEWDIALOGSTYLE |#BIF_RETURNONLYFSDIRS
  bi\lpfn = @PathCB()
  bi\lParam = @Path
  bi\lpszTitle = @StatusText
  Result = SHBrowseForFolder_(@bi)
  SHGetPathFromIDList_(Result, @Folder)
  CoTaskMemFree_(Result)
  ProcedureReturn Folder
EndProcedure

PathRequesterAPI( "Select database folder", "c:\PureBasic_601_x86\Examples\Sources\data")

Re: Advanced Path Requester [Windows]

Posted: Fri Aug 18, 2023 11:11 pm
by Gérard
Hi,
I'm not KCC, but I appreciate this code.
It will be very useful to me.
G

Re: Advanced Path Requester [Windows]

Posted: Fri Aug 18, 2023 11:34 pm
by RASHAD
Thanks G
I just didn't want to hijack tatanas thread :D

Re: Advanced Path Requester [Windows]

Posted: Sun Aug 20, 2023 5:14 pm
by Kwai chang caine
Hello RASHAD 8)
I'm KCC and i appreciate this code too :lol:

In fact, i use the most possible, the real PathRequester of Windows
It's for that i like the TATANAS code :wink:

Image

Because your PathSelect not have a field to paste a full path inside, and not have the TreeGadget and ListIconGadget together :|
And imagine when i use my supers paths of softwares i use each minutes "X:\A\N\B\T\B\D\A\A\S\E\U\A\A\A\PB\v5.73\" :mrgreen:

Image

I have time to dead each day :lol:

But thanks again for your code 8)