Library wwApi

The API class provides a number of useful utility functions that access the Windows API or other external DLL interfaces. This class also houses the wwImaging wrapper functions that talk to the wwImaging.dll.

Note that the majority of functionality in this class is implemented as plain static UDF functions, rather than methods of the class. This is to avoid having to declare a class.

However, several legacy features still exist in the so you have to ensure you use the write mechanism to access these helpers. None of the wwAPI classes actually contain any sort of state and would be better served as plain functions, but due to legacy codebase requirements they are part of the class.

Tip:
In Web Connection Process methods, wwApi is always available via Server.oApi.

Class Members

MemberDescription
CharToBin Converts a binary 4 byte (Double Word) expression into VFP number. Note: This is a static function not a class method
CharToBin(lcBinString,llSigned)
CreateProcess Runs an external process using the CreateProcess API. CreateProcess has a number of advantages over using the RUN command including a much longer command line limit and the ability to understand long…
CreateProcess(lcExe,lcCommandLine, lnShowWindow,llWaitForCompletion, lnTimeoutMs)
CreateProcessEx Runs an external process using the CreateProcessEx API including the ability to redirect output to a file and Wait for completion. CreateProcessEx has a number of advantages over using the RUN…
CreateProcessEx(lcExe, lcCommandLine, lcStartDirectory, lnShowWindow, llWaitForCompletion, lcStdOutputFilename)
GetSpecialFolder Returns a Windows Special Folder value by either a numeric value or as a special string value. You can find the numeric CSIDL codes on MSDN. Certain common string values are supported: "Program…
GetSpecialFolder(lnFolder)
GetUtcTime Returns UTC time from a local time. Note: This is a static function not a class method
o.GetUtcTime(ltTime)
GetTimeZone Returns the Timezone offset from GMT in minutes. Note: This is a static function not a class method
GetTimeZone()
GZipCompressString Compresses a string using the GZip protocol. Note: This is a static function not a method of wwAPI Note: This is a static function not a class method
GZipCompressString(lcString,lnCompressionLevel)
GZipUncompressString Uncompresses a GZip encoded string into its original unencoded data. Note: This is a static function not a method of wwAPI Note: This is a static function not a class method
GZipUncompressString(lcCompressed)
HashMD5 Creates an MD5 Hash from your data. MD5 is a one encryption hash that is frequently used for password authentication and storage of strings. Note MD5 encryption is one way, which means you can't get…
HashMD5(tcData)
MapNetworkDrive Maps a network drive based on a sharename and username and password. Shells out to command prompt using the NET USE command. Note: This is a static function not a class method
o.MapNetworkDrive(lcDrive,lcSharePath,lcUsername,lcPassword)
InstallPrinterDriver The function allows installing of a printer driver from the Windows default printer list. Used in Web Connection to install a PostScript driver for use with wwDistiller or wwGhostScript. Note: This…
InstallPrinterDriver(lcDriverName, lcPrinterName)
CreateThumbnail Creates a thumbnail image from a normal sized image by specify source and thumbnail filenames and Width and Height values. Note: This is a static function not a class method
CreateThumbnail(lcSourceFile,lcThumbnailFile,lnWidth,lnHeight)
CopyImage Allows copying an image from one file format to another. Simply specify the name of the input file and a name of the output file. Based on the extension the new image format is created. Supported…
CopyImage(lcSource,lcTarget)
GetImageInfo This function retrieves the height and width and resolution of an image. Note: This is a static function not a class method
GetImageInfo(lcImageFile, @lnWidth, @lnHeight, @lnResolution)
WriteImage This function writes an image into an existing image by overlaying it. This allows either merging of two images or if the new image has a tranparent background of overlaying. Note: This is a static…
WriteImage(lcSource,lcInsert,lnLeft,lnTop)
GetCaptchaImage Creates a CAPTCHA image with the specified text. CAPTCHA images are meant to use for validation of users on a Web site to protect from spamming. The image is returned as a file and you can use any…
GetCaptchaImage(lcText,lcOutputFile,lcFont,lnFontSize)
ReadImage Reads the contents of an area from within an image into a new file. It allows for creating cropped images. Image formats can be read and saved in gif,jpg,png,bmp,tif depending on these…
ReadImage(lcSource,lcTarget,lnLeft,lnTop,lnWidth,lnHeight)
ResizeImage Allows resizing of an image to a specified size. This method performs functionality similar to CreateThumbNail() which optimizes Thumbnail sizes and compression levels on the fly. This function…
ResizeImage(lcSource, lcTarget, lnWidth, lnHeight, lnCompression)
RotateImage Rotates an image in a file in place updating the original file. Note: This is a static function not a class method
RotateImage(lcImage,lnRotateType)
WinApi_GetStartupModuleFilename Returns a fully qualified path for the executing Windows Process executable. Note this can be either Vfp9.exe or your own application like MyApp.exe. Note: This is a static function not a class…
WinApi_GetStartupModuleFilename()
WinApi_NullString Returns a FoxPro string from a null terminated C style string. Terminates the input string at the first CHR(0) found. Note: This is a static function not a class method
WinApi_NullString(lcString)
WinApi_SendMessage Wrapper function around the Windows SendMessage API. Note: This is a static function not a class method
WinApi_SendMessage(lnHwnd,lnMsg,lnWParam,lnLParam)
WinApi_Sleep Puts the current process thread to sleep for the specified number of milliseconds. Pass llUseDoEvents for longer waits which waits for 100ms stretches interspersed with DOEVENTS that try to keep the…
WinApi_Sleep(lnMilliseconds, llUseDoEvents)
WinApi_GetEnvironmentVariable Returns a Windows Environment Variable. Unlike GETENV() it can return strings larger than 255 characters (specifically the Windows path!) lcPath =…
WinApi_GetEnvironmentVariable(lcVar)
WinApi_GetSystemErrorMsg Returns the locale specific message text from a Win32 API error code. Windows Error Codes Note: This is a static function not a class method
WinApi_GetSystemErrorMsg(lnErrorNo,lcDLL)
Is64Bit Determines whether the application is currently running under a 64 bit OS. Note: This is a static function not a class method
o.wwAPI.Is64Bit()
Ping Pings a domain and returns whether it's up and running. Optionally returns hop count and time for the ping. Note: Target site must have Ping protocol enabled in order for the target to return a Ping…
o.wwAPI.Ping(lcDomain, @lnHops, @lnTime)
CreateShortcut Creates a Windows Shortcut (.lnk) file that can be used to launch programs. Note: This is a static function not a class method
CreateShortcut(lcShortCut,lcDescription, lcTarget,lcArguments,lcStartFolder,lcIcon)
CopyFile Copies File. Faster than Fox Copy and handles errors internally without throwing a Fox error. Note: This is a static function not a class method
o.CopyFile(lcSource, lcTarget,nFlag)
DecodeDbf Takes a string encoded with EncodeDbf() and converts it back into a physical file. If the string contains a DBF with a memo the memo is also restored. Note: This is a static function not a class…
o.DecodeDbf(lcBuffer, lcDbf)
EncodeDbf Takes a single file (DBF or otherwise) or a DBF/MEMO pair and encodes it into a string. String includes a header for verification and information about the file. Use DecodeDbf() to restore the string…
o.EncodeDbf(lcDBF, llHasMemo, lcEncodedName)
FromUtcTime Returns local time from a UTC time. Optionally lets you provide a timezone offset to account for. If not provided the timezone used is the active timezone of the local machine. Note: This is a…
o.FromUtcTime(ltTime)
GetClipboardText Gets special text like RTF or HTML from the clipboard rather than retrieving only text. Formats: The formats supported are based on registered special clip board content types. Some common ones…
GetClipboardText(lcFormat)
GetDomainFromIp Retrieves the domain name from a registered IP Address. DO wwapi ? GetDomainFromIP("209.216.162.15")
o.GetDomainFromIp(lcIpAddress)
GetIpFromDomain Retrieves an IP address for a given domain. DO wwapi ? GetIpFromDomain("www.west-wind.com")
o.GetIpFromDomain(lcDomain)
GetMonitorStatus Returns an object with information about monitors and screen sizes of the system. The object contains the following properties: Monitors - number of monitors attached VirtualWidth - width of…
o.GetMonitorStatistics()
InstallPrinter Installs a printer on the system by the printer driver's descriptive name. If the printer driver name is not specified this routine will guess based on the operating system and install a PostScript…
o.wwAPI.InstallPrinter(lcDriverName,lcPrinterName)

Assembly: wwApi.prg