Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetFileNameFromBrowse
Message
 
To
18/06/2010 19:12:44
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01469704
Message ID:
01469722
Views:
54
>I`m trying to use this Api, but it doesn´t work... Any idea? Thanks.
>
>DECLARE INTEGER GetFileNameFromBrowse IN shell32;
> INTEGER hwnd,;
> STRING @ pszFilePath,;
> LONG cchFilePath,;
> STRING pszWorkingDir,;
> STRING pszDefExt,;
> STRING pszFilters,;
> STRING szTitle
>
>cFilename = SPACE(512) + CHR(0)
>nBufsize = 0
>cPath = "e:\ges24\"
>cExt= CHR(0)
>cFilter = CHR(0)
>cTitle = CHR(0)
>
>=GetFileNameFromBrowse(0, @cFilename, nBufsize,;
> cPath, cExt, cFilter, cTitle)

Your buffer should not be 0, but at least 250.
DECLARE INTEGER GetFileNameFromBrowse IN shell32;
INTEGER hwnd,;
STRING @ pszFilePath,;
LONG cchFilePath,;
STRING pszWorkingDir,;
STRING pszDefExt,;
STRING pszFilters,;
STRING szTitle

cFilename = SPACE(512) + CHR(0)
nBufsize = 250
cPath = "e:\ges24\"
cExt= CHR(0)
cFilter = CHR(0)
cTitle = CHR(0)

=GetFileNameFromBrowse(0, @cFilename, nBufsize,;
cPath, cExt, cFilter, cTitle) 
? cFileName
UPDATE: You may also want to look at the WideCharToMultiByte API. Because the filename and path that the above function returns has too many spaces in it.
Previous
Reply
Map
View

Click here to load this message in the networking platform