foxtools overview - documentation.help · foxtools is a visual foxpro api library that exposes...

46
Foxtools Overview Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to set and retrieve file information, manipulate paths and file names, use system alerts, and perform many other functions. Note The Foxtools functions aren't supported by Microsoft Product Support Services (PSS), either electronically or via telephone. Many of these functions are included for backward compatibility with FoxPro version 2.6. Some functions behave differently depending on the platform for which they are used.

Upload: vutuong

Post on 20-Sep-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

FoxtoolsOverviewFoxtoolsisaVisualFoxProAPIlibrarythatexposesWindowsDLLsforuseinVisualFoxPro.

FunctionsintheFoxtoolslibraryallowyoutosetandretrievefileinformation,manipulatepathsandfilenames,usesystemalerts,andperformmanyotherfunctions.

NoteTheFoxtoolsfunctionsaren'tsupportedbyMicrosoftProductSupportServices(PSS),eitherelectronicallyorviatelephone.ManyofthesefunctionsareincludedforbackwardcompatibilitywithFoxProversion2.6.Somefunctionsbehavedifferentlydependingontheplatformforwhichtheyareused.

Page 2: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

What'sNew

SeveralfilenamemanipulationfunctionsinFoxtools.fllhavebeenaddedtoVisualFoxPro.It'snolongernecessarytouseSETLIBRARYTOFOXTOOLS.FLLtocallthesefunctions.AsanativefunctioninVisualFoxPro,youcancallthemdirectlyinyourVisualFoxProprograms.Theyarethefollowing:

AddBS()FunctionAGetFileVersion()Function(GetFileVersion()inFoxTools)DefaultExt()FunctionDriveType()FunctionForceExt()FunctionForcePath()FunctionJustDrive()FunctionJustExt()FunctionJustFName()FunctionJustPath()FunctionJustStem()Function

Page 3: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

WhereFoxtoolsGetsInstalled

WhenyouinstallVisualFoxPro,Foxtools.fllisinstalledinthemainVisualFoxProdirectory.TousetheFoxtoolsfunctions,issuethefollowingcommand:

SETLIBRARYTOFoxtools

NoteAPIroutinesaredocumentedintheProfessionalReferencesectionofHelpunderAPILibraryConstruction.TheseroutinesmaptoeditorandwindowfunctionsandallowyoutoextendVisualFoxProusingtheCprogramminglanguage.

Page 4: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

RegFn(),RegFn32(),andCallFn()

TheFoxtoolsAPIlibraryallowsVisualFoxProprogramstocallanyWindowsDLLfunctionsthat

takethefollowingarguments:integer,long,float,double,string/buffer.Thesecanbepassedbyreferenceorbyvalue.

returnthefollowingtypes:integer,long,float,double,string/buffer.Thesearereturnedbyvalueonly.

RegFn()andRegFn32()registerafunctionandtheargumentsittakes,andCallFn()callsaregisteredfunction.TheWindowsDLLfunctionsaredocumentedinthebooksthatcomewiththeWindowsSoftwareDevelopmentKit(SDK).TheWindowsSDKisalsoincludedwithMicrosoftC/C++7.0andVisualC++.

Note

Fll32_16.dllisusedforcalling16-bitDLLsunderwin32s.Itusestheuniversalthunktocall16-bitDLLs.

Ddereg.exeisusedforcalling16-bitDLLsunderwin32.ItusesDDEtocall16-bitDLLs.

Page 5: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

AddBS()Addsabackslash(ifneeded)toapathexpression.AlsoavailableasanativefunctioninVisualFoxPro.

Syntax

AddBS(cPath)

cPath

Specifiesthepathnametowhichtoaddthebackslash.

ReturnType

Character

Page 6: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

CallFn()Callsaregisteredfunctionandreturnsthevaluethatthefunctionreturned,usingthetypedeclaredbyReturnTypeinRegFncall.

Syntax

CallFN(nFunctionHandle,Arg1[,Arg2[,...]])

nFunctionHandle

ThefunctionhandlefromapreviouscalltoRegFn()orRegFn32().

Arg1,Arg2,....

ArgumentsrequiredbythefunctionreferencedbyFnNum.Youmustpassasmanyargumentsasweredeclaredwhenthefunctionwasregisteredoranerroroccurs.

Allargumentsmustmatchtheirdeclaredtypeasfollows:

F,D–mustbeafloatingpointnumber.

I,L–mustbeaninteger.

C–mustbeastringpassedbyvalue,or0(zero).If0,anullpointerispassed.

ReturnTypes

User-definedinRegFn()orRegFn32().

Page 7: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

CleanPath()Returnsacorrectedfilename(bestguess)foraninvalidfilenameandremovesspaces,invalidcharacters,duplicatebackslashes,andsoon.

Syntax

CleanPath(cFilename)

cFilename

Specifiesthefilenametobecleaned.

ReturnTypes

Character

Page 8: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

CloseClip()ClosestheClipboardopenedpreviouslywithOpenClip().

Syntax

CloseClip()

ReturnType

Logical

Remarks

Thereturnvaluereportssuccess(.T.)orfailure(.F.)ofthecommand.AlmostallClipfunctionsrelyonopeningtheClipboardbeforeusingthefunction._CLIPTEXTcanbeusedtoaccessthecontentsoftheWindowsClipboard.

NoteThisfunctionmapstotheWindowsSDKfunctionthatissimilarlynamed.Formoreinformation,seetheWindowsSDKdocumentation.

Page 9: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

CountClipF()RetrievesthenumberofdifferentdataformatscurrentlyontheWindowsClipboard.

Syntax

CountClipF()

ReturnType

Numeric

Remarks

AlmostallClipfunctionsrelyonopeningtheClipboardbeforeusingthefunction.Youcanuse_CLIPTEXTtoaccessthecontentsoftheWindowsClipboard.

NoteThisfunctionmapstotheWindowsSDKfunctionthatissimilarlynamed.Formoreinformation,seetheWindowsSDKdocumentation.

Page 10: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

DefaultExt()Returnsafilenamewithanewextensionifonedoesn'talreadyexist.AlsoavailableasanativefunctioninVisualFoxPro.

Syntax

DefaultExt(cFilename,cDefault)

cFilename

Specifiesthefilename(withorwithoutapathorextension)tobereturned.

Cdefault

Specifiesthedefaultextensionwithoutaperiod.

ReturnType

Character

Page 11: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

DriveType()Returnsthetypeofthespecifieddrive.AlsoavailableasanativefunctioninVisualFoxPro.

Syntax

DriveType(cDrive)

cDrive

Thedrivedesignator.Thecolonindrivenames(forexample,"C:")isoptional.

ReturnTypes

Numeric

Remarks

ThefollowingtableexplainsthenumberDriveType()returnsandthecorrespondingdrivetypedescription.

Number Drivetype0 Notype2 Floppydisk3 Harddisk4 Removabledriveornetworkdrive5 CD-ROM6 RAMdisk(1)

(1)BecausetherearemanydifferenttypesofRAMdisks,youmightgetinconsistentreturnresults.

Page 12: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

EmptyClip()EmptiestheClipboardandfreeshandlestodataintheClipboard,thenassignsownershipoftheClipboardtothewindowinwhichtheClipboardisopen.

Syntax

EmptyClip()

ReturnType

Logical

Remarks

AlmostallClipfunctionsrelyonopeningtheClipboardbeforeusingthefunction.Youcanuse_CLIPTEXTtoaccessthecontentsoftheWindowsClipboard.

NoteThisfunctionmapstotheWindowsSDKfunctionthatissimilarlynamed.Formoreinformation,seetheWindowsSDKdocumentation.

Page 13: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

EnumClipFm()EnumeratestheformatsfoundinalistofavailableformatsthatbelongtotheClipboard.

Syntax

EnumClipFm(nFormat)

nFormat

SpecifiesaClipboardformat.

Todeterminetheavailableclipboardformats,setnFormatto0;EnumClipFm()willreturnthefirstavailableClipboardformat.ForsubsequentcallstoEnumClipFm(),setnFormattothereturnvalueofthepreviousEnumClipFm()call.

ReturnType

Numeric

Remarks

EachcalltoEnumClipFm()specifiesaknownavailableformat;thefunctionreturnstheformatthatappearsnextinthelist.

AlmostallClipfunctionsrelyonopeningtheClipboardbeforeusingthefunction.Youcanuse_CLIPTEXTtoaccessthecontentsoftheWindowsClipboard.

NoteThisfunctionmapstotheWindowsSDKfunctionthatissimilarlynamed.Formoreinformation,seetheWindowsSDKdocumentation.

Page 14: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

ForceExt()Returnsastringwiththeoldfilenameextensionreplacedbyanewextension.AlsoavailableasanativefunctioninVisualFoxPro.

Syntax

ForceExt(cFilename,cExtension)

cFilename

Specifiesthefilename(withorwithoutapathorextension)whichwillgetanewextension.

cExtension

Specifiesthenewextension(withoutaperiod)forcFilename.

ReturnType

Character

Page 15: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

ForcePath()Returnsafilenamewithanewpathnamesubstitutedfortheoldone.AlsoavailableasanativefunctioninVisualFoxPro.

Syntax

ForceExt(cFilename,cPath)

cFilename

Specifiesthefilename(withorwithoutapathorextension)whichwillgetanewpath.

cPath

SpecifiesthenewpathforcFilename.

ReturnType

Character

Page 16: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

FoxToolVer()ReturnstheversionnumberoftheFoxtoolslibrary.

Syntax

FoxToolVer()

ReturnType

Character

Page 17: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

GetClipDat()RetrievesahandlefortheClipboarddataofaspecifiedformatandpassesitdirectlytothecallingapplication.

Syntax

GetClipDat(nFormat)

nFormat

ContainsanidentifierforpossibleClipboardformats.

nFormat Description(definetype)1 cf_Text2 cf_Bitmap3 cf_MetaFilePict4 cf_SYLK5 cf_DIF6 cf_TIFF7 cf_OEMText8 cf_DIB9 cf_Palette

ReturnType

Logical

Remarks

Theclipboardcontrolsthehandle,nottheapplication.Theapplicationshouldcopythedataimmediately.AlmostallClipfunctionsrelyonopeningtheClipboardbeforeusingthefunction.Youcanuse_CLIPTEXTtoaccessthecontentsoftheWindowsClipboard.

NoteThisfunctionmapstotheWindowsSDKfunctionthatissimilarlynamed.

Page 18: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

Formoreinformation,seetheWindowsSDKdocumentation.

Page 19: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

GetClipFmt()RetrievesthenameofaregisteredClipboardformat.

Syntax

GetClipFmt(nFormat)

nFormat

Specifiestheregisteredformattoretrieve.Thisargumentmustnotspecifyanyofthepredefinedclipboardformats.

ReturnType

Numeric

Remarks

AlmostallClipfunctionsrelyonopeningtheClipboardbeforeusingthefunction.Youcanuse_CLIPTEXTtoaccessthecontentsoftheWindowsClipboard.

NoteThisfunctionmapstotheWindowsSDKfunctionsthatissimilarlynamed.Formoreinformation,seetheWindowsSDKdocumentation.

Page 20: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

GetFileVersion()Returnsinformationaboutafile.AlsoavailableasthenativefunctionAGETFILEVERSION()inVisualFoxPro.

Syntax

GetFileVersion(cFileName,@ArrayName)

cFileName

Specifiesthenameofthefileforwhichinformationisreturned.

ArrayName

Specifiesthenameofthearrayinwhichthefileinformationisplaced.ThearraymustbecreatedbeforeissuingGetFileVersion(),andmusthaveatleast1columnand12rows.

ReturnType

Numeric

Remarks

GetFileVersion()istypicallyusedtogetinformationabout.exeand.dllfiles.

Zeroisreturnedifthefunctionissuccessful;otherwise–1isreturned.

Thefollowingtableliststhefileinformationcontainedinthetwelvearrayelements:

ElementNumber FileInformation1 Comments2 CompanyName3 FileDescription4 FileVersion

Page 21: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

5 InternalName6 LegalCopyright7 LegalTrademarks8 OriginalFileName9 PrivateBuild10 ProductName11 ProductVersion12 SpecialBuild

Page 22: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

GetProStrg()RetrievesthestringassociatedwithanentrywithinthespecifiedsectionintheWin.iniinitializationfile.

Syntax

GetProStrg(lpszSection,lpszEntry,lpszDefault,@lpszReturnBuffer,cbReturnBuffer)

lpszSection

Pointstoanull-terminatedstringthatspecifiesthesectioncontainingtheentry.

LpszEntry

Pointertothenull-terminatedstringcontainingtheentrywhoseassociatedstringistoberetrieved.IfthisvalueisNULL,allentriesinthesectionspecifiedbythelpszSectionargumentarecopiedtothebufferspecifiedbythelpszReturnBufferargument.

LpszDefault

Pointertothedefaultvalueforthegivenentryiftheentrycan'tbefoundintheinitializationfile.ThisargumentmustneverbeNULL;itmustpointtoavalidstring,evenifthestringisempty(itsfirstcharacteriszero).

lpszReturnBuffer

Pointertothebufferthatwillreceivethecharacterstring.

cbReturnBuffer

Specifiesthesize,inbytes,ofthebufferpointedtobythelpszReturnBufferargument.

ReturnValue

Page 23: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

Numeric

Remarks

AnapplicationcanusetheGetProStrg()functiontoretrieveastringfromaspecifiedfile.

IfthelpszEntryargumentisNULL,theGetProStrg()functioncopiesallentriesinthespecifiedsectiontothesuppliedbuffer.Eachstringwillbenull-terminated,withthefinalstringterminatingwithtwonullcharacters.Ifthedestinationbufferistoosmalltoholdallthestrings,thelaststringwillbetruncatedandfollowedbytwoterminatingnullcharacters.

IfthestringassociatedwithlpszEntryisenclosedinsingleordoublequotationmarks,themarksarediscardedwhenGetProStrgreturnsthestring.

GetProStrg()isn'tcasedependent,sothestringsinthelpszSectionandlpszEntryargumentsmaycontainacombinationofuppercaseandlowercaseletters.

Thereturnvalueisthenumberofbytescopiedtothebuffer,notincludingtheterminatingzero,ifthefunctionissuccessful.

Page 24: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

IsClipFmt()IndicateswhetherdataofthespecifiedformatiscurrentlyontheClipboard.

Syntax

IsClipFmt(nFormat)

nFormat

Containsanumericvalueindicatingtheformatoftheavailabledata.

ThefollowingtablerepresentsthepredefinedWindowsformats:

nFormat Description(definetype)1 cf_Text2 cf_Bitmap3 cf_MetaFilePict4 cf_SYLK5 cf_DIF6 cf_TIFF7 cf_OEMText8 cf_DIB9 cf_Palette

ReturnType

Logical

Remarks

IsClipFmt()returnstrue(.T.)ifdataofthespecifiedformatisontheClipboard,orfalse(.F.)otherwise.

NoteThisfunctionmapstotheWindowsSDKfunctionsthatissimilarlynamed.Formoreinformation,seetheWindowsSDKdocumentation.

Page 25: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

JustDrive()Returnsthedriveletterfromacompletepath.AlsoavailableasanativefunctioninVisualFoxPro.

Syntax

JustDrive(cPath)

cPath

Specifiesthecompletepathnameforwhichyouwantonlythedrive.

ReturnType

Character

Page 26: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

JustExt()Returnsthethree-letterextensionfromacompletepath.AlsoavailableasanativefunctioninVisualFoxPro.

Syntax

JustExt(cPath)

cPath

Specifiesthename,whichmayincludethefullpath,ofthefileforwhichyouwantonlytheextension.

ReturnType

Character

Page 27: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

JustFName()Returnsthefilenameportionofacompletepathandfilename.AlsoavailableasanativefunctioninVisualFoxPro.

Syntax

JustFName(cFilename)

cFilename

Specifiesthename,whichmayincludethefullpath,ofthefileforwhichyouwantonlythefilename.

ReturnType

Character

Page 28: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

JustPath()Returnsthepathportionofacompletepathandfilename.AlsoavailableasanativefunctioninVisualFoxPro.

Syntax

JustPath(cFilename)

cFilename

Specifiesthefullname(includingpath)ofthefileforwhichyouwantonlythepath.

ReturnType

Character

Page 29: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

JustStem()Returnsthestemname(firsteightcharactersoffilename)fromacompletepathandfilename.AlsoavailableasanativefunctioninVisualFoxPro.

Syntax

JustStem(cFilename)

cFilename

Specifiesthename(includingpath)ofthefileforwhichyouwantonlythestem.

ReturnType

Character

Page 30: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

MainHwnd()Returnsthewindowhandle(HWND)ofthemainVisualFoxProwindow.

Syntax

MainHwnd()

ReturnType

Numeric

Page 31: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

MkDir()Createsadirectory.

Syntax

MkDir(cPath)

cPath

Specifiesthepathtocreate.

ReturnType

Numeric

Remarks

Thisfunctionwon'tcheckforthevalidlengthandformatofadirectorystring.Thereturnvaluesareasfollows:

0 success1 nosuccess6 directoryalreadyexists

ThisfunctionisonlyavailableinFoxtoolsversion1.01orlater.

Page 32: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

MessageBox()Displaysamodaldialogboxcenteredinthescreen.

Syntax

MessageBox(cText,cTitle,nType)

cText

Specifiesthecontentsindialogbox.

ctitle

Specifiesthetitleofdialogboxwindow.

ntype

Specifiesthetypeofdialogboxasfollows:

nType Type0 MB_OK1 MB_OKCANCEL2 MB_ABORTRETRYIGNORE3 MB_YESNOCANCEL4 MB_YESNO5 MB_RETRYCANCEL16 MB_ICONSTOP32 MB_ICONQUESTION48 MB_ICONEXCLAMATION64 MB_ICONINFORMATION

ReturnType

Numeric

Page 33: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

Remarks

MessageBox()returnsavalueindicatingthebuttonthattheuserclicked.

Returnvalue IDofbuttonclicked1 idok2 idcancel3 idabort4 idretry5 idignore6 idyes7 idno

Page 34: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

NextWord()Returnsthecharactersbetweenaspecifiedcharacterindexandthefollowingworddelimiter(ortheendofthestring).

Syntax

NextWord(cString,nPosition[,cDelimiter])

cString

Specifiesthestringtosearch.

nposition

SpecifiesthenumericpositionofthecharacterinthestringthatwillbetheinitialcharacterreturnedbyNextWord().

cdelimiter

Specifiestheoptionalworddelimiters;NextWord()returnsthestringofcharactersbetweennPostitionandthischaracter.IfcDelimiter2isn'tused,thedefaultdelimitersarespaces,tabs,andcarriagereturncharacters(ASCII13).Thedelimitercharacterisn'tincludedinthereturnedstring.

ReturnType

Character

Page 35: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

OpenClip()OpenstheClipboardforaccessbysubsequentClipboard-relatedfunctions.

Syntax

OpenClip(nHandle)

nHandle

SpecifiesthehandleofthewindowtobeassociatedwiththeClipboard.Zeroisacceptable.TogetthehandleoftheVisualFoxPromainwindow,callMainHwnd().

ReturnType

Logical

Remarks

Thereturnvaluereportssuccess(.T.)orfailure(.F.)ofthecommand.AlmostallClipfunctionsrelyonopeningtheClipboardbeforeusingthefunction.Youcanuse_CLIPTEXTtoaccessthecontentsoftheWindowsClipboard.

NoteThisfunctionmapstotheWindowsSDKfunctionthatissimilarlynamed.Formoreinformation,seetheWindowsSDKdocumentation.

Page 36: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

PutProStrg()CopiesastringintothespecifiedsectionoftheWindowsinitializationfile(Win.ini).

Syntax

PutProsStrg(lpszSection,lpszEntry,lpszString)

lpszSection

Pointertoanull-terminatedstringthatspecifiesthesectiontowhichthestringistobecopied.Ifthesectiondoesn'texist,itiscreated.Thenameofthesectioniscase-independent;thestringmaybeanycombinationofuppercaseandlowercaseletters.

LpszEntry

Pointertothenull-terminatedstringcontainingtheentrytobeassociatedwiththestring.Iftheentrydoesn'texistinthespecifiedsection,itiscreated.IfthisargumentisNULL,theentiresection,includingallentrieswithinthesection,isdeleted.

LpszString

Pointertothenull-terminatedstringtobewrittentothefile.IfthisargumentisNULL,theentryspecifiedbythelpszEntryargumentisdeleted.

ReturnType

Numeric

Remarks

Thereturnvalueisnonzeroifthefunctionissuccessful;otherwise,itiszero.

Page 37: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

Reduce()Replacesspecifiedcharactersinastringwithaspace.

Syntax

Reduce(cSearch,cReplace)

cSearch

Specifiesthecharacterstringtochange.

cReplace

Specifiesthecharacterstosearchforandreplacewithaspace.Ifyouspecifymorethanonecharacter,thecharactersaretreatedseparatelyduringthereduction;theyaren'ttreatedasasinglemulticharacterstring.

ReturnType

Character

Remarks

ReplacescharactersspecifiedincReplacewithaspace,thenremovesleadingspacesandrepeatedspaceswithinthestring.Thefunctioniscommonlyusedtoreplaceagroupofspacesinastringwithasinglespace,ortoreplacedelimiterssuchastabsorcarriagereturnswithaspace.

Page 38: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

RegClipFmt()RegistersanewClipboardformat.

Syntax

RegClipFmt(cFormat)

cFormat

Specifiesastringthatnamesthenewformat.

ReturnType

Numeric

Remarks

Theregisteredformatcanbeusedinsubsequentclipboardfunctionsasavalidformatinwhichtorenderdata,anditwillappearintheClipboard'slistofformats.

Thereturnvalueindicatesthenewlyregisteredformat.Iftheidenticalformatnamehasbeenregisteredbefore,evenbyadifferentapplication,theformat'sreferencecountisincremented(increasedbyone)andthesamevalueisreturnedaswhentheformatwasoriginallyregistered.Thereturnvalueiszeroiftheformatcan'tberegistered.

AlmostallClipfunctionsrelyonopeningtheClipboardbeforeusingthefunction.Youcanuse_CLIPTEXTtoaccessthecontentsoftheWindowsClipboard.

NoteThisfunctionmapstotheWindowsSDKfunctionthatissimilarlynamed.Formoreinformation,seetheWindowsSDKdocumentation.

Page 39: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

RGBComp()Returnsthered,green,andbluecomponentsofacompositeRGBcolorvalue.

Syntax

RGBComp(nRGBColor,@nRedVal,@nGreenVal,@nBlueVal)

nRGBColor

SpecifiesacompositeRGBcolorvaluerangingfrom0to16777215.

@nRedVal

SpecifiesareferencetoavariableinwhichthefunctionreturnstheintensityoftheredcolorcomponentofnRGBColor.

@nGreenVal

SpecifiesareferencetoavariableinwhichthefunctionreturnstheintensityofthegreencolorcomponentofnRGBColor.

@nBlueVal

SpecifiesareferencetoavariableinwhichthefunctionreturnstheintensityofthebluecolorcomponentofnRGBColor.

ReturnType

Logical

Page 40: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

RmDir()Deletesadirectory.

Syntax

RmDir(cPath)

cPath

Specifiesthepathofthedirectoryorfoldertoberemoved.

ReturnType

Numeric

Remarks

ThisfunctionisonlyavailableinFoxtoolsversion1.01orlater.

Returns0ifsuccessfuland1ifnotsuccessful.

Page 41: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

SetClipDat()SetsthedataontheopenedClipboard.

Syntax

SetClipDat(nFormat,cData)

nFormat

SpecifiesanidentifierforpossibleClipboardformats.

nFormat Description(definetype)1 cf_Text2 cf_Bitmap3 cf_MetaFilePict4 cf_SYLK5 cf_DIF6 cf_TIFF7 cf_OEMText8 cf_DIB9 cf_Palette

cData

SpecifiesthedatatoplaceontheClipboard.

ReturnType

Logical

Remarks

TheClipboardmusthavebeenopenedwithOpenClip()beforeyoucallthisfunction.IftheWindowsClipboardisrunning,itwon'tupdateitswindowtoshowthedataplacedintheClipboardbytheSetClipDat()functionuntilafter

Page 42: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

theCloseClip()functioniscalled.

NoteThisfunctionmapstotheWindowsSDKfunctionthatissimilarlynamed.Formoreinformation,seetheWindowsSDKdocumentation.

Page 43: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

StrFilter()Removesallcharactersfromastringexceptthosespecified.

Syntax

StrFilter(cString,cSearch)

cString

Specifiesthecharacterstringtosearch.

cSearch

SpecifiesthecharacterstosearchforandretainincString.

ReturnType

Character

Remarks

StrFilter()removesallthecharactersfromcStringthataren'tincSearch,thenreturnsthecharactersthatremain.StrFilter()iscase-sensitive.

Page 44: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

ValidPath()ChecksforavalidMS-DOSfilenameorpathexpression.

Syntax

ValidPath(cName)

cName

Specifiesthepathorfilenametobechecked.

ReturnType

Logical

Remarks

ValidPath()verifiesthatafilenameorpathnameissyntacticallylegal;itdoesn'tcheckfortheexistenceofthespecifiedfileorpath.Thefunctionisn'tfoolproofandcansometimesinterpretafileashavingavalidnamewhenthefilenameisactuallyinvalid.However,ValidPath()won'trejectavalidname.

Notsupportedinfilesystemsthatsupportspacesinpathnames.

Page 45: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

WordNum()Returnsthespecifiedwordinastring.

Syntax

WordNum(cString,nIndex[,cDelimiter])

cString

Specifiesthestringcontainingthewordtobereturned.

nIndex

Specifiestheindexpositionofthewordtobereturned.Forexample,ifnIndexis3,WordNum()returnsthethirdword(ifcStringcontainsthreeormorewords).

cDelimiter

SpecifiesthecharacterusedtodelimitwordsincString.Thedefaultdelimitersarespace,tab,andcarriagereturn.

ReturnType

Character

Remarks

IfcStringcontainsfewerwordsthanthenumberspecifiedwithcIndex,WordNum()returnsanemptystring.

Page 46: Foxtools Overview - documentation.help · Foxtools is a Visual FoxPro API library that exposes Windows DLLs for use in Visual FoxPro. Functions in the Foxtools library allow you to

Words()Countsthenumberofwordsinastring.

Syntax

Words(cString[,cDelimiter])

cString

Specifiesthestringofwordstobecounted.

cdelimiter

SpecifiesthecharacterusedtodelimitwordsincString.Thedefaultdelimitersarespaceandtab.

ReturnType

Numeric