FUNCTION Quote (StringToQuote AS STRING) AS STRING
StringToQuote = CHR$(34) + StringToQuote + CHR$(34)
result = REPLACESUBSTR$(stringtoquote, CHR$(34) + CHR$(34), CHR$(34))
END FUNCTION
FUNCTION StripPath (fullname AS STRING) AS STRING
result = LEFT$(fullname, rinstr(fullname, "\"))
END FUNCTION
FUNCTION StripFileName (fullname AS STRING) AS STRING
result = RIGHT$(fullname, LEN(fullname) - rinstr(fullname, "\"))
END FUNCTION
FUNCTION StripFileExt (fullname AS STRING) AS STRING
result = RIGHT$(fullname, LEN(fullname) - rinstr(fullname, ".") + 1)
END FUNCTION
FUNCTION FileNameNoExt(fullname AS STRING) AS STRING
fullname = RIGHT$(fullname, LEN(fullname) - rinstr(fullname, "\"))
result = LEFT$(fullname, rinstr(fullname, ".") - 1)
END FUNCTION
FUNCTION FullPathNoExt(fullname AS STRING) AS STRING
result = LEFT$(fullname, rinstr(fullname, ".") - 1)
END FUNCTION
FUNCTION C_Style (fullname AS STRING) AS STRING
fullname = REPLACESUBSTR$(fullname, "\\", "\")
result = REPLACESUBSTR$(fullname, "\", "/")
END FUNCTION
FUNCTION SysDir (dir AS STRING) AS STRING
DIM fo_reg AS QREGISTRY
fo_reg.RootKey = &H80000001
fo_reg.openkey ("Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", 0)
result = fo_reg.readstring(dir) + "\"
END FUNCTION
FUNCTION homedir() AS STRING
result = LEFT$(COMMAND$(0), rinstr(COMMAND$(0), "\"))
END FUNCTION
FUNCTION BrowseForFolders (initialdir AS STRING, wincapt AS STRING) AS STRING
DIM bff_form AS QFORM
WITH bff_form
.height = 400
.center
.CAPTION = wincapt
.delbordericons 2
END WITH
DIM bff_tree AS QDIRTREE
WITH bff_tree
.PARENT = bff_form
.align = 5
END WITH
IF bff_form.CAPTION = "" THEN bff_form.CAPTION = "Select folder"
IF DIREXISTS(initialdir) THEN
bff_tree.directory = initialdir
ELSE
bff_tree.directory = CURDIR$
END IF
bff_form.SHOWMODAL
result = bff_tree.directory
END FUNCTION
FUNCTION BrowseForFile (CAPTION AS STRING, filter AS STRING, _
initialdir AS STRING) AS STRING
DIM bff_od AS QOPENDIALOG
WITH bff_od
.CAPTION = CAPTION
.filter = filter
.initialdir = initialdir
IF .EXECUTE THEN
result = .filename
END IF
END WITH
END FUNCTION
|