NET4COM - .NET Toolkit for COM The NET4COM library will expose a set of COM objects. These objects will ‘wrap’ a small part of the .NET Framework to provide developers with a set of API that bring the power of the .NET Framework to VFP. The .NET Framework is a rich collection of namespaces and API that provides a comprehensive set of functionality that developers can use to build applications that run on the .NET platform. While VFP does have a rich library of API, there are some features that don’t exist in the VFP libraries. NET4COM brings together a small subset of the .NET Framework — a collection of commonly used API that brings to VFP functionality that does not exist. ================================================================================= NET4COM.dll Installation: ------------------------- VFP Sedna March CTP Setup installs NET4COM DLL and wrapper and sample files to disk. Setup will also register the COM components in NET4COM.dll. Upon installation the NET4COM folder will contain the following: NET4COM.dll -- The DLL for the COM components that wrap a subset of the .NET Framework 2.0. Readme.txt -- This file Source -- Folder containing project file and source code for NET4COM VFPSamples -- Folder containing VFP sample code that uses NET4COM VB6Samples -- Folder containing VB6 sample code that uses NET4COM FFC -- FFC wrappers for NET4COM VFP FFC wrapper class library for NET4COM: To use the wrapper classes copy the FFC folder to VFP FFC folder: HOME()+"FFC\". NET4COM Uninstallation: ----------------------- Use the Add/Remove Programs Control Panel to remove Visual FoxPro Sedna March CTP. This will unregister the NET4COM COM components and remove the installed files. Note: Uninstalling the CTP will not: * Delete the FFC files you may have copied to HOME()+"FFC\" * Delete new files created in the CTP install location ================================================================================= NET4COM Classes: Audio ----- Play (String soundFile, Integer playMode) Plays and audio file. Returns: Nothing Parameters: soundFile: String. File to play. playMode: Integer. playMode can be one of the following: 0 WaitToComplete — Plays the sound and waits until it completes before the calling code continues 1 Background — Plays the sound in the background. The calling code continues to execute. 2 BackgroundLoop — Plays the sound in the background until the Stop() method is called. The calling code continues to execute. Stop () Stops the sound playing in the background. Returns: Nothing Parameters: None PlaySystemSound (String systemSound) Plays the specified system sound. Returns: Nothing Parameters: systemSound: String. systemSound can be one of the following: 0 ASTERISK - System.Media.SystemSounds.Asterisk 1 BE - System.Media.SystemSounds.Beep 2 EXCLAMATION - System.Media.SystemSounds.Exclamation 3 HAND - System.Media.SystemSounds.Hand 4 QUESTION - System.Media.SystemSounds.Question --------------------------------------------------------------------------------- Clipboard --------- Clear() Clears the clipboard Returns: Nothing Parameters: None ContainsData (String customDataFormat) Determines if the clipboard contains data. Returns: Boolean. Returns True if the clipboard contains data in custom format. Otherwise False. Parameters: customDataFormat: String. The name of the custom format. ContainsAudio() Determines if the clipboard contains audio data. Returns: Boolean. Returns True if the clipboard contains audio data. Otherwise False. Parameters: None ContainsFileDropList() Determines if the clipboard contains a collection of strings containing path information for files. Returns: Boolean. Returns True if the clipboard contains a collection of strings containing path information for files. Otherwise False. Parameters: None ContainsImage() Determines if the clipboard contains image data. Returns: Boolean. Returns True if the clipboard contains image data. Otherwise False. Parameters: None ContainsText() Determines if the clipboard contains text data. Returns: Boolean. Returns True if the clipboard contains text data. Otherwise False. Parameters: None GetText() Gets the text that is from the clipboard. Returns: String. Returns text information from the clipboard, or an empty string if no data is present. Parameters: None SetText (String text) Writes text to the clipboard. Returns: Nothing Parameters: text: String. Text to be written. --------------------------------------------------------------------------------- Mouse ----- ButtonsSwapped() Determines if the buttons are swapped. Returns: Boolean. Returns true if the buttons are swapped. Otherwise False. Parameters: None WheelExists() Determines if the mouse has a scroll wheel. Returns: Boolean. Returns true if the mouse has a scroll wheel. Otherwise False. Parameters: None WheelScrollLines() Returns an integer that is the number of lines to scroll when the mouse wheel is rotated one notch. Returns: Integer. the number of lines to scroll when the mouse wheel is rotated one notch. Parameters: None --------------------------------------------------------------------------------- Network ------- IsAvailable () Determines if the computer is connected to a network. Returns: Boolean. Returns true if the computer is connected to a network. Otherwise False. Parameters: None Ping (String address) Pings the specified server. Returns: Boolean. True if successful. Otherwise False. Parameters: address: String. The URL, computer name, or IP number of the server to ping. DownloadFile (String address, String destinationFile) Downloads a specified remote file and saves it to a given destination. Returns: Nothing Parameters: address: String. Path of the file to download, including file name and host address. --------------------------------------------------------------------------------- PowerStatus ----------- BatteryLifePercent () Determines battery life as a percentage value. Returns: Float. Returns battery life as a percentage value as a floating point value. Parameters: None BatteryFullLifetime () Determines full charge lifetime of a battery in seconds. Returns: Integer. Returns full charge lifetime of a battery in seconds. Parameters: None BatteryLifeRemaining () Determines remaining battery life in seconds. Returns: Integer. Returns remaining battery life in seconds. Parameters: None BatteryChargeStatus () Returns a string representation of the battery charge status. Returns: Integer. Returns a string representation of the battery charge status. It can be one of the following: 1 High - Indicates a high level of battery charge. 2 Low - Indicates a low level of battery charge. 4 Critical - Indicates a critically low level of battery charge. 8 Charging - Indicates a battery is charging. 128 NoSystemBattery - Indicates that no battery is present. 255 Unknown - Indicates an unknown battery condition Parameters: None PowerLineStatus () Returns a string representation of the status of the power line for the battery. Returns: Integer. Returns a string representation of the status of the power line for the battery. It can be one of the following: 0 Offline - The system is offline. 1 Online - The system is online. 255 Unknown - The power status of the system is unknown. Parameters: None --------------------------------------------------------------------------------- Process ------- StopApp (String processName) Stops a running application. Returns: Nothing Parameters: processName: String. Name of the application to stop. StartApp (String filename) Starts an application. Returns: Nothing Parameters: fileName: String. Name of the application to stop. This can be an application filename or a document. --------------------------------------------------------------------------------- RegEx ----- Replace (String input, String pattern, String replacement) Replaces all occurrences of a character pattern defined by a regular expression with a specified replacement character string. Returns: String. The modified character string. Parameters: input: String. The string to modify. pattern: String. The regular expression pattern to match. replacement: String. The replacement string. IsMatch (String input, String pattern) Indicates whether the regular expression finds a match in the input string using the regular expression specified in the pattern parameter. Returns: Boolean. Returns True if the regular expression finds a match. Otherwise False. Parameters: input: String. The string to search for a match. pattern: String. The regular expression pattern to match. Matches (String input, String pattern) Searches the specified input string for all occurrences of the regular expression specified in the pattern parameter. Returns: String Array. The strings found by the search. Parameters: input: String. The string to search for a match. pattern: String. The regular expression pattern to match. Split (String input, String pattern) Splits the input string at the positions defined by a regular expression pattern. Returns: String Array. The split strings. Parameters: input: String. The string to split. pattern: String. The regular expression pattern to match. --------------------------------------------------------------------------------- Registry -------- GetValue (String keyName, String valueName) Returns a string that is the value of the given registry key valueName. Returns: String. The value of the given registry key valueName. Parameters: keyName: String. The name of the Key from which the value is to be retrieved. valueName: String. The name of the Value to be retrieved. SetValue (String keyName, String valueName, String value) Sets the value for a registry key valueName, as specified by value. If the key or valueName does not exist it will be created. Returns: Nothing Parameters: keyName: String. The name of the Key to be written to. valueName: String. The name of the value to be written. value: String. The value to be written. CreateKey (String hive, String subKey) Creates a subkey under the specified hive. Returns: Nothing Parameters: hive: String. Values for hive can be one of the following: HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER HKEY_DYNAMIC_DATA HKEY_LOCAL_MACHINE HKEY_PERFORMANCE_DATA HKEY_USERS subKey: String. Name of the key to create. DeleteKey (String hive, String subKey) Deletes a subkey if it exists under the specified hive. Returns: Nothing Parameters: hive: String. Values for hive can be one of the following: HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER HKEY_DYNAMIC_DATA HKEY_LOCAL_MACHINE HKEY_PERFORMANCE_DATA HKEY_USERS subKey: String. Name of the key to delete. --------------------------------------------------------------------------------- Services -------- StartService (String service) Starts the specified service. Returns: Nothing Parameters: service: String. The short name that identifies the service to the system. StopService (String service) Stops the specified service. Stops the service if it’s current state is ‘Running’, otherwise no effect. If any services depend on this service for their operation, they will be stopped before this service is stopped. Returns: Nothing Parameters: service: String. The short name that identifies the service to the system. PauseService (String service) Pauses a running service. Returns: Nothing Parameters: service: Sstring. The short name that identifies the service to the system. ContinueService (String service) Resumes the service if status is ‘Paused’, otherwise no effect. Returns: Nothing Parameters: service: String. The short name that identifies the service to the system.