Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Horrendous GETFILE replacement bug....
Message
 
 
To
23/06/2010 00:53:50
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01470173
Message ID:
01470274
Views:
81
>Hi Naomi,
>
>It looks like the code below made it. It looks like a dependancy to shell32 is more robust than older stuff based on comdlg32.dll and msvcrt.dll even provided by MS.
>
>LOCAL pszFilePath,cchFilePath,pszWorkingDir,pszDefExt,pszFilters,szTitle,cFileName
>
>DECLARE INTEGER GetActiveWindow IN win32api
>
>DECLARE INTEGER GetFileNameFromBrowse IN shell32;
>    INTEGER  hwnd,;
>    STRING @ pszFilePath,;
>    LONG     cchFilePath,;
>    STRING   pszWorkingDir,;
>    STRING   pszDefExt,;
>    STRING   pszFilters,;
>    STRING   szTitle
>    
>pszFilePath 	= REPLICATE(" ",512)+CHR(0)
>cchFilePath		= LEN(pszFilePath)
>pszWorkingDir	= STRCONV(myDirectory+CHR(0),5)
>pszDefExt		= STRCONV("csv"+CHR(0),5)
>pszFilters		= STRCONV("Text resources"+CHR(0)+"*.txt;*.csv"+CHR(0)+;
>					"fichiers MS Excel"+CHR(0)+"*.xls"+CHR(0)+CHR(0),5)
>szTitle			= STRCONV("Open resource"+CHR(0),5)
>
>IF GetFileNameFromBrowse(THISFORM.Hwnd,@pszFilePath,cchFilePath,;
>    pszWorkingDir, pszDefExt, pszFilters, szTitle) = 0
>    RETURN
>ENDIF	
>
>cFilename = STRCONV(pszFilePath,6) && unicode
>cFilename = LEFT(cFilename,AT(CHR(0),cFilename)-1)
Nice. I believe you it works.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform