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

Search Results for "RESOURCE" in [All]

odbc32

.

            //Free resources and disconnect

.
Summary
SQLFreeHandle frees resources associated with a specific environment, connection, statement, or descriptor handle.
.
Summary
SQLFreeStmt stops processing associated with a specific hstmt, closes any open cursors associated with the hstmt, discards pending results and, optionally, frees all resources associated with a statement handle.

wininet

.

        throw new InvalidOperationException(Resources.FTPClient_NoFTPSiteSpecified);

.

        throw new InvalidOperationException(Resources.FTPClient_HDSourceFileDoesNotExist);

.

To close the handle returned from InternetConnect, the application should call InternetCloseHandle. This function disconnects the client from the server and frees all resources associated with the connection.

user32

.

http://windowssdk.msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/cursors/cursorreference/cursorfunctions/clipcursor.asp

.
Summary
.

static extern IntPtr CreateIconFromResourceEx(byte [] pbIconBits, uint cbIconBits, bool fIcon, uint dwVersion, int cxDesired, int cyDesired, uint uFlags);

.

Private Shared Function CreateIconFromResourceEx(pbIconBits As Byte(), cbIconBits As UInteger, fIcon As Boolean, dwVersion As UInteger, cxDesired As Integer, cyDesired As Integer, uFlags As UInteger) As IntPtr

.
Documentation
[CreateIconFromResourceEx] on MSDN
.
Summary
.

static extern IntPtr CreateIconFromResourceEx(byte [] pbIconBits, uint

.

    Public Shared Function CreateIconFromResourceEx(ByVal pbIconBits As Byte(), _

.
Documentation
[CreateIconFromResourceEx] on MSDN
.

                // Free resources used by this Process object.

.

     ' Free resources used by this Process object.

.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/cursors/cursorreference/cursorstructures/cursorinfo.asp

.
Summary
.

static extern uint GetGuiResources(IntPtr hProcess, uint uiFlags);

.

    ///      - WIN32 resources (accelerator tables, bitmap resources, dialog box templates, font resources, menu resources, raw data resources, string table entries, message table entries, cursors/icons)

.

    extern public static int GetGuiResources(IntPtr hProcess, int uiFlags);

.

    public static int GetGuiResourcesGDICount()

.

        return GetGuiResources(Process.GetCurrentProcess().Handle, 0);

.

    public static int GetGuiResourcesUserCount()

.

        return GetGuiResources(Process.GetCurrentProcess().Handle, 1);

.
Documentation
[GetGuiResources] on MSDN
.

The hbmColor and hbmMask are pointers to unmanaged data and must be deleted after use. The following code will grab the icon info for a cursor handle and dispose of the unmanaged resources, if needed:

.

Site Resources:

.

        /// Clean up any resources being used.

.

static extern IntPtr LoadBitmap(IntPtr hInstance, long resourceID)

.

static extern IntPtr LoadBitmap(IntPtr hInstance, int resourceID);

.

For loading icon-resource identified as integer ID

.

' For loading icon-resource identified as integer ID

.

C++/CLI: This solution allows you to load an image from an unmanaged resource in the assembly. In my case I added a .cur file to my .rc. The cursor had an ID of 101. After loading the cursor I assigned it to the Forms::Cursor.

.

To use integer resource ID instead of string, and avoid using MAKEINTRESOURCE, prepend the integer with '#'. For example, to use resource ID 32512, enter "#32512" for lpszName.

.

            LOAD_LIBRARY_AS_IMAGE_RESOURCE = 0x00000020,

.

        /// <param name="resId">Name of the resource icon that should be loaded.

.

- or to load an image from a managed resource (dll):

.

[System.Drawing.Bitmap.FromResource]

.

public String GetStringResource(IntPtr hModuleInstance, uint uiStringID)

.

///     Before terminating, an application must call the UnhookWindowsHookEx function to free system resources

.

///     The global hooks are a shared resource, and installing one affects all applications in the same desktop as

.

        /// Clean up any resources being used.

ntdll

.

    ProcessResourceManagement,

cfgmgr32

.

     InvalidResourceid = 0x0000000B,

.

     FreeResources = 0x00000029,

.

     SameResources = 0x0000002D,

.

For more resources, references, calling from scripting, download code, etc, see:

advapi32

.

    const uint STATUS_INSUFFICIENT_RESOURCES = 0xc000009a;

.

        if ((ret == STATUS_INSUFFICIENT_RESOURCES) || (ret == STATUS_NO_MEMORY))

.

        if ((ret == STATUS_INSUFFICIENT_RESOURCES) || (ret == STATUS_NO_MEMORY))

.

    const uint STATUS_INSUFFICIENT_RESOURCES = 0xc000009a;

.

        if ((ret == STATUS_INSUFFICIENT_RESOURCES) || (ret == STATUS_NO_MEMORY))

.

        if (ret == STATUS_INSUFFICIENT_RESOURCES || ret == STATUS_NO_MEMORY)

.

        if (ret == STATUS_INSUFFICIENT_RESOURCES || ret == STATUS_NO_MEMORY)

.

        if ((ret == STATUS_INSUFFICIENT_RESOURCES) || (ret == STATUS_NO_MEMORY))

.

        if ((ret == STATUS_INSUFFICIENT_RESOURCES) || (ret == STATUS_NO_MEMORY))

.

   //Implement IDisposable. (from Implementing Finalize and Dispose to Clean Up Unmanaged Resources )

.

(Special Note: The .NET Framework (3.0 and earlier at least) cannot read registry values of special types (for example: REG_RESOURCE_LIST and REG_FULL_RESOURCE_DESCRIPTOR). I am not sure if they will ever be available under .NET, to see examples of these types of values at work, visit your registry under (HKLM\HARDWARE\DESCRIPTION\System) and (HKLM\HARDWARE\RESOURCEMAP\Hardware Abstraction Layer\ACPI x86 platform).

.

        RegResourceList = 8,

.

        RegFullResourceDescriptor = 9,

.

        RegResourceRequirementsList = 10,

.

static extern unsafe uint RegisterTraceGuids([In] EtwProc cbFunc, [In] void* context, [In] ref Guid controlGuid, [In] uint guidCount, ref TraceGuidRegistration guidReg, [In] string mofImagePath, [In] string mofResourceName, out ulong regHandle);

.

static extern unsafe uint RegisterTraceGuids([In] EtwProc cbFunc, [In] void* context, [In] ref Guid controlGuid, [In] uint guidCount, ref TraceGuidRegistration guidReg, [In] string mofImagePath, [In] string mofResourceName, out ulong regHandle);

.
Summary
The WNetGetUniversalName function takes a drive-based path for a network resource and returns an information structure that contains a more universal form of the name. What this means is that you can take a file name from a network drive can be converted to a UNC version that may be used from other computers on the network that do not have the same drive mappings.

Constants

32: DI_
.

/// the function uses the actual resource size.

33: LR_
.

    /// lpszName specifies the image resource in the hinst module. If the image resource is to be loaded by name,

.

    /// the lpszName parameter is a pointer to a null-terminated string that contains the name of the image resource.

.

    /// If the image resource is to be loaded by ordinal, use the MAKEINTRESOURCE macro to convert the image ordinal

.

    /// To pass these constants to the LoadImage function, use the MAKEINTRESOURCE macro. For example, to load the OCR_NORMAL cursor,

.

    /// pass MAKEINTRESOURCE(OCR_NORMAL) as the lpszName parameter and NULL as the hinst parameter.

.

    /// the function uses the actual resource size. If the resource contains multiple images, the function uses the size of the first image.

.

    /// Tries to reload an icon or cursor resource from the original resource file rather than simply copying the current image.

.

    /// This is useful for creating a different-sized copy when the resource file contains multiple sizes of the resource.

.

    /// in the resource file closest to the desired size. This will succeed only if hImage was loaded by LoadIcon or LoadCursor,

.

    public const int LR_COPYFROMRESOURCE = 0x4000;

.

    /// same resource will load the image again and return a different handle.

.

    /// When you use this flag, the system will destroy the resource when it is no longer needed.

.

    /// When loading a system icon or cursor, you must use LR_SHARED or the function will fail to load the resource.

.

    /// Windows 95/98/Me: The function finds the first image with the requested resource name in the cache, regardless of the size requested.

.

<Flags()> Public Enum LoadResourceFlags As UInteger

.

    ''' lpszName specifies the image resource in the hinst module. If the image resource is to be loaded by name,

.

    ''' the lpszName parameter is a pointer to a null-terminated string that contains the name of the image resource.

.

    ''' If the image resource is to be loaded by ordinal, use the MAKEINTRESOURCE macro to convert the image ordinal

.

    ''' To pass these constants to the LoadImage function, use the MAKEINTRESOURCE macro. For example, to load the OCR_NORMAL cursor,

.

    ''' pass MAKEINTRESOURCE(OCR_NORMAL) as the lpszName parameter and NULL as the hinst parameter.

.

    ''' the function uses the actual resource size. If the resource contains multiple images, the function uses the size of the first image.

.

    ''' Tries to reload an icon or cursor resource from the original resource file rather than simply copying the current image.

.

    ''' This is useful for creating a different-sized copy when the resource file contains multiple sizes of the resource.

.

    ''' in the resource file closest to the desired size. This will succeed only if hImage was loaded by LoadIcon or LoadCursor,

.

    LR_COPYFROMRESOURCE = &H4000

.

    ''' same resource will load the image again and return a different handle.

.

    ''' When you use this flag, the system will destroy the resource when it is no longer needed.

.

    ''' When loading a system icon or cursor, you must use LR_SHARED or the function will fail to load the resource.

.

    ''' Windows 95/98/Me: The function finds the first image with the requested resource name in the cache, regardless of the size requested.

34: NERR_
.

        /// <summary> 2105 - A network resource shortage occurred. </summary>

.

        public const int NoNetworkResource = 2105;

.

        /// <summary> 2117 - The operation is invalid on a redirected resource. </summary>

.

        /// <summary> 2119 - The server is currently out of the requested resource. </summary>

.

        /// <summary> 2222 - The resource name could not be found. </summary>

.

        public const int ResourceNotFound = 2222;

.

        /// <summary> 2225 - The resource permission list already exists. </summary>

.

        public const int ResourceExists = 2225;

.

        /// <summary> 2230 - The limit of 64 entries per resource was exceeded. </summary>

.

        /// <summary> 2310 - This shared resource does not exist. </summary>

.

        /// <summary> 2318 - This device cannot be shared as both a spooled and a non-spooled resource. </summary>

.

        /// <summary> 2372 - The system cannot delete current connections to network resources. </summary>

.

        /// <summary> 2392 - The shared resource you are connected to could not be found. </summary>

.

        /// <summary> 2519 - A second connection to a Remoteboot resource is not allowed. </summary>

.

    public static PropertyKey PKEY_Device_ResourcePickerTags = new PropertyKey(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 12);     // DEVPROP_TYPE_STRING

.

    public static PropertyKey PKEY_Device_ResourcePickerExceptions = new PropertyKey(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 13); // DEVPROP_TYPE_STRING

.

    public static PropertyKey PKEY_Calendar_Resources = new PropertyKey( 0x00F58A38, 0xC54B, 0x4C40, 0x86, 0x96, 0x97, 0x23, 0x59, 0x80, 0xEA, 0xE1, 100);

.

    public static PropertyKey WPD_OBJECT_GENERATE_THUMBNAIL_FROM_RESOURCE = new PropertyKey(0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C, 24);

.

    public static PropertyKey WPD_APPOINTMENT_RESOURCES = new PropertyKey(0xF99EFD03, 0x431D, 0x40D8, 0xA1, 0xC9, 0x4E, 0x22, 0x0D, 0x9C, 0x88, 0xD3, 11);

.

    public static PropertyKey WPD_SECTION_DATA_REFERENCED_OBJECT_RESOURCE = new PropertyKey(0x516AFD2B, 0xC64E, 0x44F0, 0x98, 0xDC, 0xBE, 0xE1, 0xC8, 0x8F, 0x7D, 0x66, 5);

.

    public static PropertyKey WPD_RENDERING_INFORMATION_PROFILE_ENTRY_CREATABLE_RESOURCES = new PropertyKey(0xC53D039F, 0xEE23, 0x4A31, 0x85, 0x90, 0x76, 0x39, 0x87, 0x98, 0x70, 0xB4, 4);

.

    public static PropertyKey WPD_RESOURCE_DEFAULT = new PropertyKey(0xE81E79BE, 0x34F0, 0x41BF, 0xB5, 0x3F, 0xF1, 0xA0, 0x6A, 0xE8, 0x78, 0x42, 0);

.

    public static PropertyKey WPD_RESOURCE_CONTACT_PHOTO = new PropertyKey(0x2C4D6803, 0x80EA, 0x4580, 0xAF, 0x9A, 0x5B, 0xE1, 0xA2, 0x3E, 0xDD, 0xCB, 0);

.

    public static PropertyKey WPD_RESOURCE_THUMBNAIL = new PropertyKey(0xC7C407BA, 0x98FA, 0x46B5, 0x99, 0x60, 0x23, 0xFE, 0xC1, 0x24, 0xCF, 0xDE, 0);

.

    public static PropertyKey WPD_RESOURCE_ICON = new PropertyKey(0xF195FED8, 0xAA28, 0x4EE3, 0xB1, 0x53, 0xE1, 0x82, 0xDD, 0x5E, 0xDC, 0x39, 0);

.

    public static PropertyKey WPD_RESOURCE_AUDIO_CLIP = new PropertyKey(0x3BC13982, 0x85B1, 0x48E0, 0x95, 0xA6, 0x8D, 0x3A, 0xD0, 0x6B, 0xE1, 0x17, 0);

.

    public static PropertyKey WPD_RESOURCE_ALBUM_ART = new PropertyKey(0xF02AA354, 0x2300, 0x4E2D, 0xA1, 0xB9, 0x3B, 0x67, 0x30, 0xF7, 0xFA, 0x21, 0);

.

    public static PropertyKey WPD_RESOURCE_GENERIC = new PropertyKey(0xB9B9F515, 0xBA70, 0x4647, 0x94, 0xDC, 0xFA, 0x49, 0x25, 0xE9, 0x5A, 0x07, 0);

.

    public static PropertyKey WPD_RESOURCE_VIDEO_CLIP = new PropertyKey(0xB566EE42, 0x6368, 0x4290, 0x86, 0x62, 0x70, 0x18, 0x2F, 0xB7, 0x9F, 0x20, 0);

.

    public static PropertyKey WPD_RESOURCE_BRANDING_ART = new PropertyKey(0xB633B1AE, 0x6CAF, 0x4A87, 0x95, 0x89, 0x22, 0xDE, 0xD6, 0xDD, 0x58, 0x99, 0);

.

    public static PropertyKey WPD_RESOURCE_ATTRIBUTE_TOTAL_SIZE = new PropertyKey(0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6, 2);

.

    public static PropertyKey WPD_RESOURCE_ATTRIBUTE_CAN_READ = new PropertyKey(0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6, 3);

.

    public static PropertyKey WPD_RESOURCE_ATTRIBUTE_CAN_WRITE = new PropertyKey(0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6, 4);

.

    public static PropertyKey WPD_RESOURCE_ATTRIBUTE_CAN_DELETE = new PropertyKey(0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6, 5);

.

    public static PropertyKey WPD_RESOURCE_ATTRIBUTE_OPTIMAL_READ_BUFFER_SIZE = new PropertyKey(0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6, 6);

.

    public static PropertyKey WPD_RESOURCE_ATTRIBUTE_OPTIMAL_WRITE_BUFFER_SIZE = new PropertyKey(0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6, 7);

.

    public static PropertyKey WPD_RESOURCE_ATTRIBUTE_FORMAT = new PropertyKey(0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6, 8);

.

    public static PropertyKey WPD_RESOURCE_ATTRIBUTE_RESOURCE_KEY = new PropertyKey(0x1EB6F604, 0x9278, 0x429F, 0x93, 0xCC, 0x5B, 0xB8, 0xC0, 0x66, 0x56, 0xB6, 9);

.

    public static PropertyKey WPD_COMMAND_OBJECT_RESOURCES_GET_SUPPORTED = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 2);

.

    public static PropertyKey WPD_COMMAND_OBJECT_RESOURCES_GET_ATTRIBUTES = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 3);

.

    public static PropertyKey WPD_COMMAND_OBJECT_RESOURCES_OPEN = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 4);

.

    public static PropertyKey WPD_COMMAND_OBJECT_RESOURCES_READ = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 5);

.

    public static PropertyKey WPD_COMMAND_OBJECT_RESOURCES_WRITE = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 6);

.

    public static PropertyKey WPD_COMMAND_OBJECT_RESOURCES_CLOSE = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 7);

.

    public static PropertyKey WPD_COMMAND_OBJECT_RESOURCES_DELETE = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 8);

.

    public static PropertyKey WPD_COMMAND_OBJECT_RESOURCES_CREATE_RESOURCE = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 9);

.

    public static PropertyKey WPD_COMMAND_OBJECT_RESOURCES_REVERT = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 10);

.

    public static PropertyKey WPD_COMMAND_OBJECT_RESOURCES_SEEK = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 11);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_OBJECT_ID = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1001);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_ACCESS_MODE = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1002);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_KEYS = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1003);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_ATTRIBUTES = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1004);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_CONTEXT = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1005);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_TO_READ = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1006);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_READ = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1007);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_TO_WRITE = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1008);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_WRITTEN = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1009);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_DATA = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1010);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_OPTIMAL_TRANSFER_BUFFER_SIZE = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1011);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_SEEK_OFFSET = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1012);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_SEEK_ORIGIN_FLAG = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1013);

.

    public static PropertyKey WPD_PROPERTY_OBJECT_RESOURCES_POSITION_FROM_START = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 1014);

.

    public static PropertyKey WPD_OPTION_OBJECT_RESOURCES_SEEK_ON_READ_SUPPORTED = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 5001);

.

    public static PropertyKey WPD_OPTION_OBJECT_RESOURCES_SEEK_ON_WRITE_SUPPORTED = new PropertyKey(0xB3A2B22D, 0xA595, 0x4108, 0xBE, 0x0A, 0xFC, 0x3C, 0x96, 0x5F, 0x3D, 0x4A, 5002);

.

    public static PropertyKey WPDNSE_OBJECT_HAS_CONTACT_PHOTO = new PropertyKey(0x34d71409, 0x4b47, 0x4d80, 0xaa, 0xac, 0x3a, 0x28, 0xa4, 0xa3, 0xb3, 0xe6, 2); // [ VT_BOOL ] Indicates whether the object has a contact photo resource.  

.

    public static PropertyKey WPDNSE_OBJECT_HAS_THUMBNAIL = new PropertyKey(0x34d71409, 0x4b47, 0x4d80, 0xaa, 0xac, 0x3a, 0x28, 0xa4, 0xa3, 0xb3, 0xe6, 3); // [ VT_BOOL ] Indicates whether the object has a thumbnail resource.  

.

    public static PropertyKey WPDNSE_OBJECT_HAS_ICON = new PropertyKey(0x34d71409, 0x4b47, 0x4d80, 0xaa, 0xac, 0x3a, 0x28, 0xa4, 0xa3, 0xb3, 0xe6, 4); // [ VT_BOOL ] Indicates whether the object has an icon resource.  

.

    public static PropertyKey WPDNSE_OBJECT_HAS_AUDIO_CLIP = new PropertyKey(0x34d71409, 0x4b47, 0x4d80, 0xaa, 0xac, 0x3a, 0x28, 0xa4, 0xa3, 0xb3, 0xe6, 5); // [ VT_BOOL ] Indicates whether the object has a voice annotation resource.  

.

    public static PropertyKey WPDNSE_OBJECT_HAS_ALBUM_ART = new PropertyKey(0x34d71409, 0x4b47, 0x4d80, 0xaa, 0xac, 0x3a, 0x28, 0xa4, 0xa3, 0xb3, 0xe6, 6); // [ VT_BOOL ] Indicates whether the object has an album art resource.  

.

    public static PropertyKey WPDNSE_OBJECT_OPTIMAL_READ_BLOCK_SIZE = new PropertyKey(0x34d71409, 0x4b47, 0x4d80, 0xaa, 0xac, 0x3a, 0x28, 0xa4, 0xa3, 0xb3, 0xe6, 7); // [ VT_UI4 ] The optimal buffer size clients can use to read data chunks of the default resource.  

.
Summary
RESOURCE* constants
.

const UInt32 RESOURCE_CONNECTED = 0x00000001;

.

const UInt32 RESOURCE_GLOBALNET = 0x00000002;

.

const UInt32 RESOURCE_REMEMBERED = 0x00000003;

.

const UInt32 RESOURCETYPE_ANY = 0x00000000;

.

const UInt32 RESOURCETYPE_DISK = 0x00000001;

.

const UInt32 RESOURCETYPE_PRINT = 0x00000002;

.

const UInt32 RESOURCEUSAGE_CONNECTABLE = 0x00000001;

.

const UInt32 RESOURCEUSAGE_CONTAINER = 0x00000002;

.

const UInt32 RESOURCEUSAGE_RESERVED = 0x80000000;

.

const UInt32 RESOURCEDISPLAYTYPE_GENERIC = 0x00000000;

.

const UInt32 RESOURCEDISPLAYTYPE_DOMAIN = 0x00000001;

.

const UInt32 RESOURCEDISPLAYTYPE_SERVER = 0x00000002;

.

const UInt32 RESOURCEDISPLAYTYPE_SHARE = 0x00000003;

.

const UInt32 RESOURCEDISPLAYTYPE_FILE = 0x00000004;

.

const UInt32 RESOURCEDISPLAYTYPE_GROUP = 0x00000005;

.

const UInt32 RESOURCEDISPLAYTYPE_TREE = 0x0000000A;

.

        /// The specified network resource or device is no longer available.

.

        /// The network resource type is not correct.

.

        /// Not enough resources are available to process this command.

.

        /// The requested resource is in use.

.

        /// The local device name has a remembered connection to another network resource.

.

        /// Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again..

.

        /// Insufficient system resources exist to complete the requested service.

.

        public const int ERROR_NO_SYSTEM_RESOURCES = 1450;

.

        /// Insufficient system resources exist to complete the requested service.

.

        public const int ERROR_NONPAGED_SYSTEM_RESOURCES = 1451;

.

        /// Insufficient system resources exist to complete the requested service.

.

        public const int ERROR_PAGED_SYSTEM_RESOURCES = 1452;

.

        /// Not enough resources are available to complete this operation.

.

        public const int RPC_S_OUT_OF_RESOURCES = 1721;

.

        /// The specified image file did not contain a resource section.

.

        public const int ERROR_RESOURCE_DATA_NOT_FOUND = 1812;

.

        /// The specified resource type cannot be found in the image file.

.

        public const int ERROR_RESOURCE_TYPE_NOT_FOUND = 1813;

.

        /// The specified resource name cannot be found in the image file.

.

        public const int ERROR_RESOURCE_NAME_NOT_FOUND = 1814;

.

        /// The specified resource language ID cannot be found in the image file.

.

        public const int ERROR_RESOURCE_LANG_NOT_FOUND = 1815;

.

        /// A resource required for this operation is disabled.

.

        public const int ERROR_RESOURCE_DISABLED = 4309;

.

        /// The resource required for this operation does not exist.

.

        public const int ERROR_RESOURCE_NOT_PRESENT = 4316;

.

        /// The last remaining item in this group or resource cannot be deleted.

.

        /// The cluster resource cannot be moved to another group because other resources are dependent on it.

.

        public const int ERROR_DEPENDENT_RESOURCE_EXISTS = 5001;

.

        /// The cluster resource dependency cannot be found.

.

        /// The cluster resource cannot be made dependent on the specified resource because it is already dependent.

.

        /// The cluster resource is not online.

.

        public const int ERROR_RESOURCE_NOT_ONLINE = 5004;

.

        /// The cluster resource is not available.

.

        public const int ERROR_RESOURCE_NOT_AVAILABLE = 5006;

.

        /// The cluster resource could not be found.

.

        public const int ERROR_RESOURCE_NOT_FOUND = 5007;

.

        /// The cluster node is not the owner of the resource.

.

        public const int ERROR_HOST_NODE_NOT_RESOURCE_OWNER = 5015;

.

        /// The cluster resource could not be created in the specified resource monitor.

.

        /// The cluster resource could not be brought online by the resource monitor.

.

        /// The operation could not be completed because the cluster resource is online.

.

        public const int ERROR_RESOURCE_ONLINE = 5019;

.

        /// The cluster resource could not be deleted or brought offline because it is the quorum resource.

.

        public const int ERROR_QUORUM_RESOURCE = 5020;

.

        /// The cluster could not make the specified resource a quorum resource because it is not capable of being a quorum resource.

.

        /// The group or resource is not in the correct state to perform the requested operation.

.

        /// The properties were stored but not all changes will take effect until the next time the resource is brought online.

.

        public const int ERROR_RESOURCE_PROPERTIES_STORED = 5024;

.

        /// The cluster could not make the specified resource a quorum resource because it does not belong to a shared storage class.

.

        /// The cluster resource could not be deleted since it is a core resource.

.

        public const int ERROR_CORE_RESOURCE = 5026;

.

        /// The quorum resource failed to come online.

.

        public const int ERROR_QUORUM_RESOURCE_ONLINE_FAILED = 5027;

.

        /// The cluster node failed to take control of the quorum resource because the resource is owned by another active node.

.

        /// A cluster resource failed.

.

        public const int ERROR_RESOURCE_FAILED = 5038;

.

        /// One or more cluster resources depend on the network to provide service to clients. The client access capability cannot be removed from the network.

.

        /// This operation cannot be performed on the cluster resource as it the quorum resource. You may not bring the quorum resource offline or modify its possible owners list.

.

        /// The cluster quorum resource is not allowed to have any dependencies.

.

        /// The cluster resource cannot be brought online. The owner node cannot run this resource.

.

        public const int ERROR_NODE_CANT_HOST_RESOURCE = 5071;

.

        /// This resource cannot be created because the cluster has reached the limit on the number of resources it can monitor.

.

        public const int ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED = 5076;

.

        /// The specified resource type was not found.

.

        public const int ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND = 5078;

.

        /// The specified node does not support a resource of this type.  This may be due to version inconsistencies or due to the absence of the resource DLL on this node.

.

        /// The specified resource name is not supported by this resource DLL. This may be due to a bad (or changed) name supplied to the resource DLL.

.

        /// The resource monitor will not allow the fail operation to be performed while the resource is in its current state. This may happen if the resource is in a pending state.

.

        /// An attempt to modify a resource property failed because it conflicts with another existing property.

.

        public const int ERROR_RESOURCE_PROPERTY_UNCHANGEABLE = 5089;

.

        /// The quorum resource does not contain the quorum log.

.

        /// Two or more parameter values specified for a resource's properties are in conflict.

.

        /// Cross-domain move of non-empty resource groups is not allowed.

.

        public const int ERROR_DS_CANT_MOVE_RESOURCE_GROUP = 8499;

.

        /// Error due to lack of resources.

.

        /// Lack of system resources has required isolated activation to be disabled for the current thread of execution.

.

        /// Another single phase resource manager has already been enlisted in this transaction.

.

        /// The resource manager has requested to be the coordinator (last resource manager) for the transaction.

.

        /// Another single phase resource manager has already been enlisted in this transaction.

.

        /// Instead of committing, the resource heuristically aborted.

.

        /// Instead of aborting, the resource heuristically committed.

.

        /// Some of the states of the resource were committed while others were aborted, likely because of heuristic decisions.

.

        /// Some of the states of the resource may have been committed while others may have been aborted, likely because of heuristic decisions.

.

        /// There is no resource presently associated with this enlistment

.

        public const int XACT_E_NORESOURCE = (int)(0x8004D00C - 0x100000000);

.

        /// The transaction failed to commit due to the failure of optimistic concurrency control in at least one of the resource managers.

.

        /// The resource manager id is not associated with this transaction or the transaction manager.

.

        /// The indicated unit of work does not match the unit of work expected by the resource manager.

.

        /// The transaction status is in doubt. A communication failure occurred, or a transaction manager or resource manager has failed

.

        /// Resource manager reenlistment to determine transaction status timed out.

.

        /// The transaction was successfully aborted. However, this is a coordinated transaction, and some number of enlisted resources were aborted outright because they could not support abort-retaining semantics

.

        /// The sink is content and wishes the transaction to proceed. Changes were made to one or more resources during this call.

.

        /// The resource manager has performed a single-phase commit of the transaction.

.

        /// The resource manager has requested to be the coordinator (last resource manager) for the transaction.

.

        public const int XACT_S_LASTRESOURCEMANAGER = 0x0004D010;

.

        /// There are insufficient resources to open another file.

.

        /// Could not allocate some required resource (memory, events, ...)

.

        public const int RPC_E_OUT_OF_RESOURCES = (int)(0x80010101 - 0x100000000);

.

        /// OSS ASN.1 Error: System resource error.

.

        /// The Smart card resource manager is not running.

.

        /// The Smart card resource manager has shut down.

.

        /// Cannot create a duplicate resource of type Distributed Transaction Coordinator

.

        public const int MSDTC_E_DUPLICATE_RESOURCE = (int)(0x80110701 - 0x100000000);

38: WM
.
WM_FONTCHANGE 0x1D An application sends the WM_FONTCHANGE message to all top-level windows in the system after changing the pool of font resources.

winfax

.
Summary
Releases resources associated with a buffer allocated previously as the result of a function call by a fax client application.

rasapi32

.
Summary
The RasHangUp function terminates a remote access connection. The connection is specified with a RAS connection handle. The function releases all RASAPI32.DLL resources associated with the handle

ws2_32

.
Summary
Cleans up the Windows Sockets resources. Ensure this method is called after every successful call to WSAStartup().

netapi32

.

        if (!LookupAccountName(this.ResourceName, this.UserName, Sid, ref cbSid, referencedDomainName, ref cchReferencedDomainName, out sidUse))

.

            if (!LookupAccountName(this.ResourceName, this.UserName, Sid, ref cbSid, referencedDomainName, ref cchReferencedDomainName, out sidUse))

.

        aSystemName.SetTo(this.ResourceName);

.

    If MsgBox("Are you sure you want to disconnect this resource?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then

.

        /// Unable to contact resource. Connection timed out.

.

The NetShareGetInfo function retrieves information about a particular shared resource on a server.

.

        const int NERR_NetNameNotFound = 2310; // This shared resource does not exist.

.

You can also use the WNetAddConnection2 and WNetAddConnection3 functions to redirect a local device to a network resource. Connections added by NetUseAdd are not shown in the Explorer. You should use one of the WNetAddConnection methods to make the networkdrive visible in the explorer.

.
Summary
The NetUseDel function ends a connection to a shared resource.
.
Summary
NetUseEnum - The NetUseEnum function lists all current connections between the local computer and resources on remote servers.

mpr

.
Summary
The MultinetGetConnectionPerformance function returns information about the expected performance of a connection used to access a network resource.
.

        NetResource lpNetResource,

.

        /// the current connection with the resource, with any routing

.

    private class NETRESOURCE

.

        public ResourceScope dwScope = 0;

.

        public ResourceType dwType = 0;

.

        public ResourceDisplayType dwDisplayType = 0;

.

        public ResourceUsage dwUsage = 0;

.

    public enum ResourceScope

.

        RESOURCE_CONNECTED = 1,

.

        RESOURCE_GLOBALNET,

.

        RESOURCE_REMEMBERED,

.

        RESOURCE_RECENT,

.

        RESOURCE_CONTEXT

.

    public enum ResourceType

.

        RESOURCETYPE_ANY,

.

        RESOURCETYPE_DISK,

.

        RESOURCETYPE_PRINT,

.

        RESOURCETYPE_RESERVED

.

    public enum ResourceUsage

.

        RESOURCEUSAGE_CONNECTABLE = 0x00000001,

.

        RESOURCEUSAGE_CONTAINER = 0x00000002,

.

        RESOURCEUSAGE_NOLOCALDEVICE = 0x00000004,

.

        RESOURCEUSAGE_SIBLING = 0x00000008,

.

        RESOURCEUSAGE_ATTACHED = 0x00000010,

.

        RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED),

.

    public enum ResourceDisplayType

.

        RESOURCEDISPLAYTYPE_GENERIC,

.

        RESOURCEDISPLAYTYPE_DOMAIN,

.

        RESOURCEDISPLAYTYPE_SERVER,

.

        RESOURCEDISPLAYTYPE_SHARE,

.

        RESOURCEDISPLAYTYPE_FILE,

.

        RESOURCEDISPLAYTYPE_GROUP,

.

        RESOURCEDISPLAYTYPE_NETWORK,

.

        RESOURCEDISPLAYTYPE_ROOT,

.

        RESOURCEDISPLAYTYPE_SHAREADMIN,

.

        RESOURCEDISPLAYTYPE_DIRECTORY,

.

        RESOURCEDISPLAYTYPE_TREE,

.

        RESOURCEDISPLAYTYPE_NDSCONTAINER

.

    public enum ResourceConnection

.

private static extern int WNetAddConnection2( NETRESOURCE lpNetResource,

.

NETRESOURCE nr = new NETRESOURCE();

.

nr.dwType = ResourceType.RESOURCETYPE_DISK;

.

nr.dwDisplayType = ResourceDisplayType.RESOURCEDISPLAYTYPE_SHARE;

.

nr.dwScope = ResourceScope.RESOURCE_GLOBALNET;

.

nr.dwUsage = ResourceUsage.RESOURCEUSAGE_CONNECTABLE;

.

int result = WNetAddConnection2(nr, password, user, (int)ResourceConnection.CONNECT_TEMPORARY);

.

/* Uses Struct rather than class version of NETRESOURCE */

.

    ref NETRESOURCE lpNetResource, string lpPassword,

.

    ''' Use to pass handle to Provider of Network Resource

.

    ''' <param name="lpNetResource"></param>

.

                           ByVal lpNetResource As NETRESOURCE, _

.

NETRESOURCE

.

private const int RESOURCETYPE_ANY = 0x0;

.

NETRESOURCE ConnInf = new NETRESOURCE();

.

ConnInf.dwType = RESOURCETYPE_ANY;

.
Summary
The WNetAddConnection2 function makes a connection to a network resource. The function can redirect a local device to the network resource.
.

The WNetAddConnection2 function supersedes the WNetAddConnection function. If you can pass a handle to a window that the provider of network resources can use as an owner window for dialog boxes, call the WNetAddConnection3 function instead.

.

// This must be used if NETRESOURCE is defined as a struct

.

public static extern int WNetAddConnection2(ref NETRESOURCE netResource,

.

// This must be used if NETRESOURCE is defined as a class

.

public static extern int WNetAddConnection2(NETRESOURCE netResource,

.

// my NETRESOURCE is defined as:

.

//    class NETRESOURCE

.

  //      public enum ResourceScope

.

  //      RESOURCE_CONNECTED = 1,

.

  //      RESOURCE_GLOBALNET,

.

  //      RESOURCE_REMEMBERED,

.

  //      RESOURCE_RECENT,

.

  //      RESOURCE_CONTEXT

.

  //      public enum ResourceType

.

  //      RESOURCETYPE_ANY    = 0,

.

  //      RESOURCETYPE_DISK       = 1,

.

  //      RESOURCETYPE_PRINT      = 2,

.

  //      RESOURCETYPE_RESERVED   = 8,

.

  //      RESOURCETYPE_UNKNOWN    = -1,

.

  //      public enum ResourceUsage

.

  //      RESOURCEUSAGE_CONNECTABLE = 0x00000001,

.

  //      RESOURCEUSAGE_CONTAINER = 0x00000002,

.

  //      RESOURCEUSAGE_NOLOCALDEVICE = 0x00000004,

.

  //      RESOURCEUSAGE_SIBLING = 0x00000008,

.

  //      RESOURCEUSAGE_ATTACHED = 0x00000010,

.

  //      RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED),

.

  //      public enum ResourceDisplayType

.

  //      RESOURCEDISPLAYTYPE_GENERIC,

.

  //      RESOURCEDISPLAYTYPE_DOMAIN,

.

  //      RESOURCEDISPLAYTYPE_SERVER,

.

  //      RESOURCEDISPLAYTYPE_SHARE,

.

  //      RESOURCEDISPLAYTYPE_FILE,

.

  //      RESOURCEDISPLAYTYPE_GROUP,

.

  //      RESOURCEDISPLAYTYPE_NETWORK,

.

  //      RESOURCEDISPLAYTYPE_ROOT,

.

  //      RESOURCEDISPLAYTYPE_SHAREADMIN,

.

  //      RESOURCEDISPLAYTYPE_DIRECTORY,

.

  //      RESOURCEDISPLAYTYPE_TREE,

.

  //      RESOURCEDISPLAYTYPE_NDSCONTAINER

.

  //      private class NETRESOURCE

.

  //      public ResourceScope dwScope = 0;

.

  //      public ResourceType dwType = 0;

.

  //      public ResourceDisplayType dwDisplayType = 0;

.

  //      public ResourceUsage dwUsage = 0;

.

  //      private static extern ErrorCodes WNetAddConnection2(NETRESOURCE lpNetResource,ref string lpPassword,ref

.

public static extern int WNetAddConnection2( [In] NETRESOURCE netResource,

.

' This must be used if NETRESOURCE is defined as a struct

.

Declare Function WNetAddConnection2 Lib "mpr.dll" (ByRef netResource As _

.

   NETRESOURCE, password As String, Username As String, Flag As Integer) As Integer

.

' This must be used if NETRESOURCE is defined as a class

.

Declare Function WNetAddConnection2 Lib "mpr.dll" (netResource As _

.

   NETRESOURCE, password As String, Username As String, Flag As Integer) As Integer

.

NETRESOURCE

.

NETRESOURCE myNetResource = new NETRESOURCE();        

.

myNetResource.dwScope = 2;                    

.

myNetResource.dwType = 1 ;                    

.

myNetResource.dwDisplayType = 3;            

.

myNetResource.dwUsage = 1;            

.

myNetResource.LocalName = "z:";        

.

myNetResource.RemoteName = @"\servername\sharename";        

.

myNetResource.Provider = null;        

.

// int ret = WNetAddConnection2( myNetResource, "username", "password", 0);

.

int ret = WNetAddConnection2( myNetResource, "password", "username", 0); //by honglinlee

.

    var netResource = new NetResource()

.

        Scope = ResourceScope.GlobalNetwork,

.

        ResourceType = ResourceType.Disk,

.

        DisplayType = ResourceDisplaytype.Share,

.

        netResource,

.

    private static extern int WNetAddConnection2(NetResource netResource,

.

public class NetResource

.

    public ResourceScope Scope;

.

    public ResourceType ResourceType;

.

    public ResourceDisplaytype DisplayType;

.

public enum ResourceScope : int

.

public enum ResourceType : int

.

public enum ResourceDisplaytype : int

.

    public enum ResourceScope

.

        RESOURCE_CONNECTED = 1,

.

        RESOURCE_GLOBALNET,

.

        RESOURCE_REMEMBERED,

.

        RESOURCE_RECENT,

.

        RESOURCE_CONTEXT

.

    public enum ResourceType

.

        RESOURCETYPE_ANY,

.

        RESOURCETYPE_DISK,

.

        RESOURCETYPE_PRINT,

.

        RESOURCETYPE_RESERVED

.

    public enum ResourceUsage

.

        RESOURCEUSAGE_CONNECTABLE = 0x00000001,

.

        RESOURCEUSAGE_CONTAINER = 0x00000002,

.

        RESOURCEUSAGE_NOLOCALDEVICE = 0x00000004,

.

        RESOURCEUSAGE_SIBLING = 0x00000008,

.

        RESOURCEUSAGE_ATTACHED = 0x00000010,

.

        RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED),

.

    public enum ResourceDisplayType

.

        RESOURCEDISPLAYTYPE_GENERIC,

.

        RESOURCEDISPLAYTYPE_DOMAIN,

.

        RESOURCEDISPLAYTYPE_SERVER,

.

        RESOURCEDISPLAYTYPE_SHARE,

.

        RESOURCEDISPLAYTYPE_FILE,

.

        RESOURCEDISPLAYTYPE_GROUP,

.

        RESOURCEDISPLAYTYPE_NETWORK,

.

        RESOURCEDISPLAYTYPE_ROOT,

.

        RESOURCEDISPLAYTYPE_SHAREADMIN,

.

        RESOURCEDISPLAYTYPE_DIRECTORY,

.

        RESOURCEDISPLAYTYPE_TREE,

.

        RESOURCEDISPLAYTYPE_NDSCONTAINER

.

    private class NETRESOURCE

.

        public ResourceScope dwScope = 0;

.

        public ResourceType dwType = 0;

.

        public ResourceDisplayType dwDisplayType = 0;

.

        public ResourceUsage dwUsage = 0;

.

    private static extern int WNetAddConnection2(NETRESOURCE lpNetResource, string lpPassword, string lpUsername, int dwFlags);

.

        NETRESOURCE myNetResource = new NETRESOURCE();

.

        myNetResource.lpLocalName = drive;

.

        myNetResource.lpRemoteName = unc;

.

        myNetResource.lpProvider = null;

.

        int result = WNetAddConnection2(myNetResource, password, user, 0);

.

    Dim myResource As NETRESOURCE

.

    myResource.dwScope = 2

.

    myResource.dwType = 1

.

    myResource.dwDisplayType = 3

.

    myResource.LocalName = LocalName

.

    myResource.RemoteName = RemoteName

.

    myResource.dwUsage = Nothing

.

    myResource.Comment = Nothing

.

    myResource.Provider = Nothing

.

    returnValue = WNetAddConnection2(myResource, password, username, 0)

.

        MsgBox("Could not connect to " & myResource.RemoteName & ". The server said this: " & vbNewLine & vbNewLine & "(Error " & returnValue & ") " & errorM)

.

/* Uses Struct rather than class version of NETRESOURCE */

.

    ref NETRESOURCE lpNetResource, string lpPassword,

.

    ''' Use to pass handle to Provider of Network Resource

.

    ''' <param name="lpNetResource"></param>

.

                           ByRef lpNetResource As NETRESOURCE, _

.

NETRESOURCE

.

private const int RESOURCETYPE_ANY = 0x0;

.

NETRESOURCE ConnInf = new NETRESOURCE();

.

ConnInf.dwType = RESOURCETYPE_ANY;

.

WNetEnumResource

.

public static extern uint WNetEnumResource(IntPtr hEnum, ref int lpcCount, IntPtr lpBuffer, ref uint lpBufferSize);

.

Public Shared Function WNetEnumResource(hEnum As IntPtr, ByRef lpcCount As Integer, lpBuffer As IntPtr, ByRef lpBufferSize As UInteger) As UInteger

.

  public static extern int WNetEnumResource(

.

    RESOURCE_SCOPE dwScope,

.

    RESOURCE_TYPE dwType,

.

    RESOURCE_USAGE dwUsage,

.

    [MarshalAs(UnmanagedType.AsAny)][In] Object lpNetResource,

.

public enum RESOURCE_SCOPE

.

    RESOURCE_CONNECTED = 0x00000001,

.

    RESOURCE_GLOBALNET = 0x00000002,

.

    RESOURCE_REMEMBERED = 0x00000003,

.

    RESOURCE_RECENT= 0x00000004,

.

    RESOURCE_CONTEXT= 0x00000005

.

public enum RESOURCE_TYPE

.

    RESOURCETYPE_ANY= 0x00000000,

.

    RESOURCETYPE_DISK= 0x00000001,

.

    RESOURCETYPE_PRINT = 0x00000002,

.

    RESOURCETYPE_RESERVED = 0x00000008,

.

public enum RESOURCE_USAGE

.

    RESOURCEUSAGE_CONNECTABLE =0x00000001,

.

    RESOURCEUSAGE_CONTAINER=0x00000002,

.

    RESOURCEUSAGE_NOLOCALDEVICE =0x00000004,

.

    RESOURCEUSAGE_SIBLING=0x00000008,

.

    RESOURCEUSAGE_ATTACHED=0x00000010,

.

    RESOURCEUSAGE_ALL =(RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED),

.

public enum RESOURCE_DISPLAYTYPE

.

    RESOURCEDISPLAYTYPE_GENERIC= 0x00000000,

.

    RESOURCEDISPLAYTYPE_DOMAIN= 0x00000001,

.

    RESOURCEDISPLAYTYPE_SERVER= 0x00000002,

.

    RESOURCEDISPLAYTYPE_SHARE= 0x00000003,

.

    RESOURCEDISPLAYTYPE_FILE = 0x00000004,

.

    RESOURCEDISPLAYTYPE_GROUP= 0x00000005,

.

    RESOURCEDISPLAYTYPE_NETWORK= 0x00000006,

.

    RESOURCEDISPLAYTYPE_ROOT = 0x00000007,

.

    RESOURCEDISPLAYTYPE_SHAREADMIN = 0x00000008,

.

    RESOURCEDISPLAYTYPE_DIRECTORY = 0x00000009,

.

    RESOURCEDISPLAYTYPE_TREE = 0x0000000A,

.

    RESOURCEDISPLAYTYPE_NDSCONTAINER = 0x0000000B

.

public struct NETRESOURCE

.

    public RESOURCE_SCOPE dwScope;

.

    public RESOURCE_TYPE dwType;

.

    public RESOURCE_DISPLAYTYPE dwDisplayType;

.

    public RESOURCE_USAGE dwUsage;

.

       RESOURCE_SCOPE.RESOURCE_GLOBALNET,

.

       RESOURCE_TYPE.RESOURCETYPE_ANY,

.

       RESOURCE_USAGE.RESOURCEUSAGE_ALL,

.

       NETRESOURCE nr;

.

     iRet =WNetEnumResource( ptrHandle, ref entries, ptrBuffer, ref buffer );

.

        nr = (NETRESOURCE)Marshal.PtrToStructure( ptr, typeof(NETRESOURCE) );

.

        if(RESOURCE_USAGE.RESOURCEUSAGE_CONTAINER == (nr.dwUsage

.

            & RESOURCE_USAGE.RESOURCEUSAGE_CONTAINER))

.

Module modEnumResource

.

    Public Enum RESOURCE_SCOPE

.

    RESOURCE_CONNECTED = &H1

.

    RESOURCE_GLOBALNET = &H2

.

    RESOURCE_REMEMBERED = &H3

.

    RESOURCE_RECENT = &H4

.

    RESOURCE_CONTEXT = &H5

.

    Public Enum RESOURCE_TYPE

.

    RESOURCETYPE_ANY = &H0

.

    RESOURCETYPE_DISK = &H1

.

    RESOURCETYPE_PRINT = &H2

.

    RESOURCETYPE_RESERVED = &H8

.

    Public Enum RESOURCE_USAGE

.

    RESOURCEUSAGE_CONNECTABLE = &H1

.

    RESOURCEUSAGE_CONTAINER = &H2

.

    RESOURCEUSAGE_NOLOCALDEVICE = &H4

.

    RESOURCEUSAGE_SIBLING = &H8

.

    RESOURCEUSAGE_ATTACHED = &H10

.

    RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE Or RESOURCEUSAGE_CONTAINER Or RESOURCEUSAGE_ATTACHED)

.

    Public Enum RESOURCE_DISPLAYTYPE

.

    RESOURCEDISPLAYTYPE_GENERIC = &H0

.

    RESOURCEDISPLAYTYPE_DOMAIN = &H1

.

    RESOURCEDISPLAYTYPE_SERVER = &H2

.

    RESOURCEDISPLAYTYPE_SHARE = &H3

.

    RESOURCEDISPLAYTYPE_FILE = &H4

.

    RESOURCEDISPLAYTYPE_GROUP = &H5

.

    RESOURCEDISPLAYTYPE_NETWORK = &H6

.

    RESOURCEDISPLAYTYPE_ROOT = &H7

.

    RESOURCEDISPLAYTYPE_SHAREADMIN = &H8

.

    RESOURCEDISPLAYTYPE_DIRECTORY = &H9

.

    RESOURCEDISPLAYTYPE_TREE = &HA

.

    RESOURCEDISPLAYTYPE_NDSCONTAINER = &HB

.

    Public Structure NETRESOURCE

.

    Public dwScope As RESOURCE_SCOPE

.

    Public dwType As RESOURCE_TYPE

.

    Public dwDisplayType As RESOURCE_DISPLAYTYPE

.

    Public dwUsage As RESOURCE_USAGE

.

    Public Function WNetEnumResource(ByVal hEnum As IntPtr, ByRef lpcCount As Integer, ByVal lpBuffer As IntPtr, ByRef lpBufferSize As Integer) As Integer

.

    Public Function WNetOpenEnum(ByVal dwScope As RESOURCE_SCOPE, ByVal dwType As RESOURCE_TYPE, ByVal dwUsage As RESOURCE_USAGE, ByRef lpNetResource As NETRESOURCE, ByRef lphEnum As IntPtr) As Integer

.

    Public Function GetNetworkDrives(ByRef o As NETRESOURCE, ByRef networkDriveCollection As List(Of String)) As Boolean

.

        iRet = WNetOpenEnum(RESOURCE_SCOPE.RESOURCE_REMEMBERED, RESOURCE_TYPE.RESOURCETYPE_ANY, RESOURCE_USAGE.RESOURCEUSAGE_ATTACHED, o, ptrHandle)

.

        Dim nr As NETRESOURCE

.

        iRet = WNetEnumResource(ptrHandle, entries, ptrBuffer, buffer)

.

            nr = CType(Marshal.PtrToStructure(ptr, GetType(NETRESOURCE)), NETRESOURCE)

.

            If (RESOURCE_USAGE.RESOURCEUSAGE_CONTAINER = (nr.dwUsage And RESOURCE_USAGE.RESOURCEUSAGE_CONTAINER)) Then

.

    Public Function GetNetworkComputers(ByRef o As NETRESOURCE, ByRef networkComputersCollection As List(Of String)) As Boolean

.

        iRet = WNetOpenEnum(RESOURCE_SCOPE.RESOURCE_GLOBALNET, RESOURCE_TYPE.RESOURCETYPE_ANY, RESOURCE_USAGE.RESOURCEUSAGE_CONTAINER, o, ptrHandle)

.

        Dim nr As NETRESOURCE

.

        iRet = WNetEnumResource(ptrHandle, entries, ptrBuffer, buffer)

.

            nr = CType(Marshal.PtrToStructure(New IntPtr(ptr), GetType(NETRESOURCE)), NETRESOURCE)

.

            If (RESOURCE_USAGE.RESOURCEUSAGE_CONTAINER = (nr.dwUsage And RESOURCE_USAGE.RESOURCEUSAGE_CONTAINER)) Then

.

    Public Function WNETOE(ByRef o As NETRESOURCE, ByRef resourceCollection As List(Of String)) As Boolean

.

        iRet = WNetOpenEnum(RESOURCE_SCOPE.RESOURCE_GLOBALNET, RESOURCE_TYPE.RESOURCETYPE_ANY, RESOURCE_USAGE.RESOURCEUSAGE_CONTAINER, o, ptrHandle)

.

        Dim nr As NETRESOURCE

.

        iRet = WNetEnumResource(ptrHandle, entries, ptrBuffer, buffer)

.

            nr = CType(Marshal.PtrToStructure(New IntPtr(ptr), GetType(NETRESOURCE)), NETRESOURCE)

.

            If (RESOURCE_USAGE.RESOURCEUSAGE_CONTAINER = (nr.dwUsage And RESOURCE_USAGE.RESOURCEUSAGE_CONTAINER)) Then

.

            If Not WNETOE(nr, resourceCollection) Then

.

            resourceCollection.Add(String.Format(nr.lpLocalName & " = " & nr.lpRemoteName))

.

        If ex.Message <> "" Then resourceCollection.Add(ex.Message)

.
Documentation
[WNetEnumResource] on MSDN
.

localName is the local name for the network resource (drive or printer)

.

remoteName is a string builder used to return the network name for the resource

.

public static extern UInt32 WNetOpenEnum(ResourceScope dwScope, ResourceType dwType, ResourceUsage dwUsage, NetResource lpNetResource, ref IntPtr lphEnum);

.

Public Shared Function WNetOpenEnum(dwScope As ResourceScope, dwType As ResourceType, dwUsage As ResourceUsage, lpNetResource As NetResource, ByRef lphEnum As IntPtr) As UInteger

.

ResourceScope, ResourceType, ResourceUsage, NetResource

.
Summary
Makes a connection to a network resource. The function can redirect a local device to a network resource.
.

    NETRESOURCE lpNetResource,

.

public enum ResourceScope

.

public enum ResourceType

.

public enum ResourceDisplayType

.

public enum ResourceUsage

.

private class NETRESOURCE

.

    public ResourceScope        dwScope       = 0;

.

    public ResourceType         dwType        = 0;

.

    public ResourceDisplayType  dwDisplayType = 0;

.

    public ResourceUsage        dwUsage       = 0;

.

    NETRESOURCE nr = new NETRESOURCE()

.

       dwType       = ResourceType.DISK,

.

    NETRESOURCE nr = new NETRESOURCE()

.

       dwType       = ResourceType.DISK,

winscard

.
Summary
The SCardConnect function establishes a connection (using a specific resource manager context) between the calling application and a smart card contained by a specific reader. If no card exists in the specified reader, an error is returned.
.
Summary
The SCardEstablishContext function establishes the resource manager context (the scope) within which database operations are performed.
.

    // string cResourceToFree);

.
Summary
The SCardFreeMemory function releases memory that has been returned from the resource manager using the SCARD_AUTOALLOCATE length designator.

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: