Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

NETRESOURCE (Structures)
 
.
Summary
Contains information about a network resource.

C# Definitions:

// Use this when the unmanaged API expects the structure passed by-value,
// or if you want to pass it by-reference as a pointer to a structure
struct NETRESOURCE
{    
   public int dwScope;    
   public int dwType;
   public int dwDisplayType;    
   public int dwUsage;    
   public string LocalName;    
   public string RemoteName;    
   public string Comment;    
   public string Provider;
}

// Use this when you want to pass it by-value even though the unmanaged API expects
// a pointer to a structure.  Being a class adds an extra level of indirection
[StructLayout(LayoutKind.Sequential)]
class NETRESOURCE
{    
   public int dwScope;    
   public int dwType;
   public int dwDisplayType;    
   public int dwUsage;    
   public string LocalName;    
   public string RemoteName;    
   public string Comment;    
   public string Provider;
}

VB.Net Definitions:

' Use this when the unmanaged API expects the structure passed by-value, or
' if you want to pass it by-reference as a pointer to a structure.
Public Structure NETRESOURCE
    Public dwScope As Integer
    Public dwType As Integer
    Public dwDisplayType As Integer
    Public dwUsage As Integer
    Public LocalName As String
    Public RemoteName As String
    Public Comment As String
    Public Provider As String
End Structure

Notes:

Without the Structlayout the WNetAddConnection2 does not work !!!

This is defined as a class rather than a structure, so it's only appropriate for passing (by-value) when a pointer to a structure is needed.

Documentation
NETRESOURCE on MSDN

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions