Class 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 some of the functionality in this class is implemented as plain functions, rather than methods of the class. This is to avoid having to declare a class. 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

ActivateWindow

Activates the Window specified by Window Title or Window Handle.

o.ActivateWindow(lvTitle,lnParentHandle)

aProfileSections

Retrieves all sections of an INI File.

o.aProfileSections(@laSections, lcIniFile)

CharToBin

Converts a binary 4 byte (Double Word) expression into VFP number.

CharToBin(lcBinString,llSigned)

CopyFile

Copies File. Faster than Fox Copy and handles errors internally without throwing a Fox error.

o.CopyFile(lcSource, lcTarget,nFlag)

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 formats include gif,jpg,png,tif,bmp.

CopyImage(lcSource,lcTarget)

CreateGUID

Creates either a string or binary GUID value.\

o.CreateGUID(llBinary)

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 filenames correctly.

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(lcExe, lcCommandLine, lcStartDirectory, lnShowWindow, llWaitForCompletion, lcStdOutputFilename)

CreateShortcut

Creates a Windows Shortcut (.lnk) file that can be used to launch programs.

CreateShortcut(lcShortCut,lcDescription, lcTarget,lcArguments,lcStartFolder,lcIcon)

CreateThumbnail

Creates a thumbnail image from a normal sized image by specify source and thumbnail filenames and Width and Height values.

CreateThumbnail(lcSourceFile,lcThumbnailFile,lnWidth,lnHeight)

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.

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 to a file.

o.EncodeDbf(lcDBF, llHasMemo, lcEncodedName)

EnumKey

Returns a registry value from a key name based on a numeric index.

o.EnumKey(tnHKey, tcSubKey, tnIndex)

FromUtcTime

Returns local time from a UTC time.

o.FromUtcTime(ltTime)

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.

GetCaptchaImage(lcText,lcOutputFile,lcFont,lnFontSize)

GetClipboardText

Gets special text like RTF or HTML from the clipboard rather than retrieving only text.

GetClipboardText(lcFormat)

GetComputerName

Returns the name of the computer as a string.

o.GetComputerName()

GetDomainFromIp

Retrieves the domain name from a registered IP Address.

o.GetDomainFromIp(lcIpAddress)

GetImageInfo

This function retrieves the height and width and resolution of an image.

GetImageInfo(lcImageFile, @lnWidth, @lnHeight, @lnResolution)

GetIpFromDomain

Retrieves an IP address for a given domain.

o.GetIpFromDomain(lcDomain)

GetLastError

Returns the last Windows API error code. Should be called immediately after an API function if an error occurred to retrieve the error code.

o.GetLastError()

GetMonitorStatus

Returns an object with information about monitors and screen sizes of the system.

o.GetMonitorStatistics()

GetProfileString

Read Profile String information from a given text file using Windows INI formatting conventions

o.GetProfileString(pcFileName,pcSection,pcEntry, pnBufferSize)

GetSpecialFolder

Returns a Windows Special Folder value by either a numeric value or as a special string value.

GetSpecialFolder(lnFolder)

GetSystemDir

Returns the Windows System directory.

o.GetSystemDir(llWindowsDir)

GetSystemErrorMsg

Returns the Message text for a Win32API error code.

o.GetSystemErrorMsg(lnErrorNo,lcDLL)

GetTempPath

Returns the Windows OS temp file path.

o.GetTempPath()

GetTimeZone

Returns the Timezone offset from GMT in minutes.

GetTimeZone()

GetUserName

Returns the currently logged on user.

o.GetUserName()

GetUtcTime

Returns UTC time from a local time.

o.GetUtcTime(ltTime)

GZipCompressString

Compresses a string using the GZip protocol.

GZipCompressString(lcString,lnCompressionLevel)

GZipUncompressString

Uncompresses a GZip encoded string into its original unencoded data.

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.

HashMD5(tcData)

ImpersonateUser

Allows you to switch user context to a different user in your application by specifying username and password.

o.ImpersonateUser(lcUsername,lcPassword)

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 Printer.

o.wwAPI.InstallPrinter(lcDriverName,lcPrinterName)

InstallPrinterDriver

The function allows installing of a printer driver from the Windows default printer list.

InstallPrinterDriver(lcDriverName, lcPrinterName)

Is64Bit

Determines whether the application is currently running under a 64 bit OS.

o.wwAPI.Is64Bit()

LogonUser

Allows checking whether a username and password are valid with Windows security.

o.LogonUser(lcUsername, lcPassword, lcServer)

MapNetworkDrive

Maps a network drive based on a sharename and username and password.

o.MapNetworkDrive(lcDrive,lcSharePath,lcUsername,lcPassword)

MessageBeep

Sounds the specified System sound.

o.MessageBeep(lnSound)

Ping

Pings a domain and returns whether it's up and running. Optionally returns hop count and time for the ping.

o.wwAPI.Ping(lcDomain, @lnHops, @lnTime)

PlayWave

Plays a WAV file synchronously or asynchronously.

o.PlayWave(pcWaveFile,pnPlayType)

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 extensions.

ReadImage(lcSource,lcTarget,lnLeft,lnTop,lnWidth,lnHeight)

ReadRegistryString

Reads a string or integer value from the registry.

o.ReadRegistryString(tnHKey, tcSubkey, tcEntry, tlInteger)

ResizeImage

Allows resizing of an image to a specified size.

ResizeImage(lcSource, lcTarget, lnWidth, lnHeight, lnCompression)

RevertToSelf

This method reverts the impersonated user back to the original user that the application was started under. Useful to rever the user after having called ImpersonateUser.

o.RevertToSelf()

RotateImage

Rotates an image in a file in place updating the original file.

RotateImage(lcImage,lnRotateType)

WinApi_GetEnvironmentVariable

Returns a Windows Environment Variable. Unlike GETENV() it can return strings larger than 255 characters (specifically the Windows path!)

WinApi_GetEnvironmentVariable(lcVar)

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.

WinApi_GetStartupModuleFilename()

WinApi_GetSystemErrorMsg

Returns the locale specific message text from a Win32 API error code.

WinApi_GetSystemErrorMsg(lnErrorNo,lcDLL)

WinApi_NullString

Returns a FoxPro string from a null terminated C style string. Terminates the input string at the first CHR(0) found.

WinApi_NullString(lcString)

WinApi_SendMessage

Wrapper function around the Windows SendMessage API.

WinApi_SendMessage(lnHwnd,lnMsg,lnWParam,lnLParam)

WinApi_Sleep

Puts the current process thread to sleep for the specified number of milliseconds.

WinApi_Sleep(lnMilliseconds, llUseDoEvents)

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.

WriteImage(lcSource,lcInsert,lnLeft,lnTop)

WriteProfileString

Writes a value into an INI file.

o.WriteProfileString(pcFileName,pcSection,pcEntry,pcValue)

WriteRegistryString

Writes a string value to the registry.

o.WriteRegistryString(tnHKey, tcSubkey, tcEntry, tcValue,tlCreate)

Requirements

Assembly: wwApi.prg

© West Wind Technologies, 2024 • Updated: 05/28/24
Comment or report problem with topic