Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Map drive letter
Message
From
19/12/2000 07:34:14
 
 
To
18/12/2000 08:36:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00454633
Message ID:
00454973
Views:
16
>Can I map drive letter to a directory or drive of other computer on network?
>Can I assign a property to multi-textbox (ex., FontName/FontSize) of a report?

Try this function out



*!******************************************************************************
*!
*! Procedure DRIVEMAP
*!
*! Calls
*!
*!******************************************************************************
Proc drivemap
*06/16/1999 Map network drives from within VFP
*The following code adds three WIN32 functions to VFP that allow a network
*drives to be mapped to a local drive indicator (e.g. R:) Disconnection of
*the network drive and how to determine how a local mapping is mapped to a
*network resource.

** To add a connection, use the following format:
**
** nResult = WNetAddConnection(, , )

** To cancel a connection use the format:
**
** nResult = WNetCancelConnection(, )

** To determine what a netword resource is mapped to use the format:
**
** nResult = WNetGetConnection(, @, @)

*** Parmeters:
**
** nResult is zero if the function was successful. Non-zero return values are errors:
** 2 = An error occurred on the network.
** 6 = The password was invalid.
**
** cSharePath is in the form: \\networkmachinename\resource or \\ipaddress\resource
** For example: "\\MyComputer\cDrive" or "\\207.31.10.7\c" or "\\207.31.10.7\HP5"
**
** cPassword is the password assigned to the network resource. Set to the null string if there is no password for the resource.
**
** cLocalResource indicate a drive letter or printer port. For example: "LPT1" for a printer port or "R" for a drive letter.
**
** nForce if set to a non-zero value will disconnection the network resource even if there are open files on the connection.
**
** nLen incidates the length of cSharePath with the WNetGetConnection function.
**
*** Examples:
**
** WNetAddConnection("\\MyNetworkComputer\DriveC", "MyPassWord", "M:")
** WNetAddConnection("\\127.13.10.4\c", "MyNetworkPassWord", "R:")
** WNetAddConnection("\\127.13.10.4\HP5", "MyPrinterPassWord", "LPT6:")
**
** nLen = 50
** cNetPath = SPACE(nLen)
** WNetGetConnection("R:", @cNetPath, nLen) && What R: is mapped to is returned in cNetPath terminated by CHR(0).
**
** WNetCancelConnection("R:", 1) && Destroys the R: drive mapping even if open files exist on the connection.
**
*** Notes:
**
** Once a network resource is mapped or disconnected it applies to the entire O/S and not just the VFP session. In other words
** if you use these VFP fuctions to map resources the mappings will stillbe there even after VFP has been closed. This
** includes even DOS sessions.


*** Actual code to add the three network resource functions to VFP
**
**
Declare INTEGER WNetAddConnection IN MPR.DLL STRING cNetPath, STRING cPassword, STRING cLocalName
Declare INTEGER WNetCancelConnection IN MPR.DLL STRING cName, LONG nForce
Declare INTEGER WNetGetConnection IN WIN32API STRING cLocalName, STRING @cNetPath, INTEGER @nLen

Return
Previous
Reply
Map
View

Click here to load this message in the networking platform