Visual FoxPro how to add and remove the network connection
Outlined in the foxpro for Windows 2.x and Foxtools.fll with Visual FoxPro in DECLARE DLL command using the definition of the relevant Windows API (Application Programming Interface) function, you can add and remove FoxPro networks.
Only continue to support the Visual FoxPro control FOXTOOLS as a backward-compatible database, DECLARE commands to call DLL function is the better way.
For more information, including the following sections FoxPro 2.x and Visual FoxPro usage agreement.
FOXTOOLS used in FoxPro 2.x database, follow the steps below to add and remove network connections.
Loading database with the following command:
SET LIBRARY TO SYS (2004) + 'FOXTOOLS.FLL' ADDITIVE
Register you want to call the Windows API function. Under the present circumstances is that we need to WNetAddConnection () and WNetCancelConnection ().
addconn = RegFn ( 'WNetAddConnection', 'CCC', 'I')
delconn = RegFn ( 'WNetCancelConnection', 'CI', 'I')
To connect to the network equipment, issued the following command:
= CallFn (addconn, "\ \ SERVER \ SHARE", "password", "<drive>:")
To be disconnected from the network, released the following command:
= CallFn (delconn, "<drive>:", 0)
DECLARE DLL command using the definition of the DLL function to call:
**-- DLL definition
Declare integer WNetAddConnection in WIN32API string, string, string Declare integer Declare integer WNetCancelConnection in WIN32API String, integer
Add a network connection **--
= WNetAddConnection ( "\ \ SERVER \ SHARE", "", "DriveLetter:")
**-- Remove the network connection
= WNetCancelConnection ( "DriveLetter:", 0)
The following information provides API calls to the two additional reference material.
WNetAddConnection () function to redirect the specified local device (disk or print-port) for a given shared device or remote device. It uses the following parameters:
Point to null at the end of the string that specifies the connection to network resources, such as \ \ Server \ Share.
NOTE: Novell users usually do not use:: symbol to invoke the server and directory. For example, do not try to use the following methods to invoke a directory:
\ \ server \ volume:: \ mydirectory.
And should use the following methods:
\ \ server \ volume \ mydirectory
Point to null at the end of the string that specifies the operation to connect to the password. This parameter is usually associated with the current user password, if the parameter is null, then use the default password. If the string is air, do not use a password (using ordinary empty string as a placeholder):
= CallFn (addconn, "\ \ SERVER \ share ","","< drive>:")
Point to a null string at the end of the string to be designated a local device redirection. LpszLocalName string all (such as LPT1) is case-sensitive. Only use the device name is A: to Z: and the device name to LPT1 LPT3.
WNetCancelConnection () function of the abolition of the network connection. It uses the following parameters:
Point to null at the end of the string that specifies the redirection of the local device name (such as LPT1: or D:) or the lifting of the long-range connectivity to network resources. When the parameter specifies a redirected local device, the redirection of the specified equipment to be dismantled. If the parameter specifies a remote network resources, then the only connection to the remote resources rather than equipment to be dismantled.
Specified even if the connection has open files or tasks, whether or not to interrupt any connection. If the parameter is FALSE, then there are open files or tasks, the failure of the function call.
Reference on the WNetAddConnection () and WNetCancelConnection () API call for more information, please see the Microsoft Windows software development Kit (SDK) "Programmer Reference, Volume II: function."
Note: API calls return value will not be FoxPro for Windows conversion.
Visual FoxPro DECLARE command on the details, see "DECLARE - DLL" Help Topics
Original author: James
Visual FoxPro Tutorial Articles
- VFP edit box method for automatic correction
- Visual FoxPro 9.0 is more powerful
- Dbf of how to use VFP to SQL Server 7.0 Distributed Query
- VFP the secondary development of smart sensors
- The contents of two databases on the output HTML format methods
- FoxWeb line with the rapid release of your database FOXPRO
- In Chinese and English to achieve VFP5.0 automatically switch
- In VFP to achieve with the combination of variant and an oval frame graphics menu
- Programmed to run through a dial-up network connection
- VFP to achieve in your browser to run the application method
- Visual FoxPro Application for increase in file compression
- Animation of simulation in the VFP
- Using Visual FoxPro 5.0 design data file structure browser
- VFP table tracking method
- In VFP print statements to achieve the specified number of records per page
- Procedures to allow VFP to run in a browser
- Visual FoxPro how to add and remove the network connection
- VFP and SQL SERVER like to do with C / S system
- OK karaoke subtitles colored dynamic display
- In a networked environment using Foxpro database management software developed under the Experience
Can't Find What You're Looking For?
Rating: Not yet rated