Advanced Path Requester [Windows]

Share your advanced PureBasic knowledge/code with the community.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Advanced Path Requester [Windows]

Post 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")
Egypt my love
Gérard
User
User
Posts: 48
Joined: Sat Oct 17, 2015 6:00 pm
Location: France
Contact:

Re: Advanced Path Requester [Windows]

Post by Gérard »

Hi,
I'm not KCC, but I appreciate this code.
It will be very useful to me.
G
■ Win10 64-bit (Intel Celeron CPU N2920 @ 1.86GHz, 4,0GB RAM, Intel HD Graphics) & PB 6.00 LTS
■ Vivre et laisser vivre.
■ PureBasic pour le fun
■ cage sur le forum Français
■ Mes sites: http://pbcage.free.fr - http://yh.toolbox.free.fr
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: Advanced Path Requester [Windows]

Post by RASHAD »

Thanks G
I just didn't want to hijack tatanas thread :D
Egypt my love
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Advanced Path Requester [Windows]

Post 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)
ImageThe happiness is a road...
Not a destination
Post Reply