Home > database >  How to implement the API function to open the system browse the file dialog
How to implement the API function to open the system browse the file dialog

Time:09-19

CodePudding user response:

GetFileOpenName

CodePudding user response:

API calls?

CodePudding user response:

Choose the path
GetFileSaveName, want to enter the name
GetFolder, do not need to input the name
This is a pb internal function

CodePudding user response:

//folder browsing general API function dialog
The FUNCTION Long SHBrowseForFolder (REF str_BROWSEINFO lpBrowseInfo) LIBRARY "shell32. DLL" ALIAS FOR "SHBrowseForFolderA; Ansi
"SUBROUTINE CoTaskMemFree (Long hMem) LIBRARY "ole32. DLL
"The FUNCTION Long SHGetPathFromIDList (Long pidList, REF string lpBuffer) LIBRARY "shell32. DLL" ALIAS FOR "SHGetPathFromIDListA; Ansi
"

String ls_ReturnPathName
Long ll_rc
Str_BROWSEINFO lstr_Info
Long ll_pIDlRoot
Long ll_BrowseInfoFlags

Ls_ReturnPathName=Space (256)
Ll_browseinfoflags=BIF_RETURNONLYFSDIRS + BIF_USENEWUI

//initialize the structure browseinfo
Lstr_info. HWndOwner=Handle (This)
Lstr_info. DisplayName=ls_ReturnPathName
Lstr_info. Title="please select a folder directory:
Lstr_info. Pidlroot=ll_pIDlRoot
Lstr_info. Flags=ll_BrowseInfoFlags

//show the browse folders dialog
Ll_rc=SHBrowseForFolder (lstr_Info)

IF ll_rc & gt; 0 THEN

SHGetPathFromIDList (ll_rc ls_ReturnPathName)

//release the memory
CoTaskMemFree (ll_rc)

Return RightTrim (ls_ReturnPathName)
The Else
Return ""
End the If


Global type str_browseinfo from structure
Long hwndowner
Long pidlroot
String displayname
String title
Long flags
Long PFN
Long param
String image
End type

  • Related