Click here to Skip to main content
15,888,290 members
Articles / Programming Languages / C#
Article

Full functional .NET Wrapper for the WNet API

Rate me:
Please Sign up or sign in to vote.
2.70/5 (10 votes)
30 Jan 2004 49.8K   751   14   5
A simple project containing .NET function-wrappers of WNet API.

Introduction

This is a full functional .Net-wrapper to allow easiest access to the WNet API.

The project have the following function-wrappers:

plain
void AddConnection(string remoteName, string password, string localName);
void AddConnection(NetResource netResource, string password, 
       string userName, ConnectionFlags options);
void AddConnection(Control ownerWindow, 
       NetResource netResource, string password, 
       string userName, ConnectionFlags options);
void CancelConnection(string name, bool isForce);
void CancelConnection(string name, ConnectionFlags options, bool isForce);
DialogResult ConnectionDialog(Control ownerWindow, ResourceType type);
DialogResult ConnectionDialog(ConnectDialogInfo info);
DialogResult DisconnectWithDialog(Control ownerWindow, ResourceType type);
NetResource[] EnumResources(ResourceScope scope, 
       ResourceType type, ResourceUsage usage, NetResource target);
string GetConnectionRemoteName(string localName);
string GetConnection(string localName);
void GetLastError(out int errorCode, 
       out string errorText, out string providerName);
NetInfo GetNetworkInformation(string provider);
string GetProviderName(NetworkType netType);
string GetUser(string name);
ConnectInfo GetConnectionPerformance(NetResource netResource);
NetResource GetResourceInformation(NetResource netResource, out string path);
NetResource GetResourceInformation(NetResource netResource);
NetResource GetResourceParent(NetResource netResource);
string GetUniversalName(string localPath);
RemoteNameInfo GetRemoteUniversalName(string localPath);
string UseConnection(Control ownerWindow, 
       NetResource netResource, string password, 
       string userId, ConnectionFlags flags);

The following functions still have not been wrapped:

plain
WNetConnectionDialog1
WNetDisconnectDialog1

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Russian Federation Russian Federation
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralThanks! Pin
ethedy5-Feb-10 1:41
ethedy5-Feb-10 1:41 
Nice and useful contribution! Good job
GeneralGetting error while trying to get UNC path Pin
mailtorakib11-Jun-09 9:21
mailtorakib11-Jun-09 9:21 
QuestionLicense? Pin
Andrew Saals14-Aug-08 19:57
Andrew Saals14-Aug-08 19:57 
GeneralGreat article Pin
TomV@CodeProject7-Aug-07 21:55
TomV@CodeProject7-Aug-07 21:55 
GeneralWNetConnectionDialog1 Pin
nmdange11-Mar-04 3:19
nmdange11-Mar-04 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.