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 "set" in [All]

ws2_32

.

    [DllImport("ws2_32.dll", CharSet = CharSet.Unicode, SetLastError = true)]

.

    /// Set *argp to a nonzero value if the nonblocking mode should be enabled,

.

        SIO_SET_QOS = -2013265909,

.

        SIO_SET_GROUP_QOS = -2013265908,

.

        SIO_SET_MULTICAST_FILTER = -2147191683,

.

        SIO_UDP_CONNRESET = -1744830452,

.

        /// Set *argp to a nonzero value if the nonblocking mode should be enabled,

.

[DllImport("ws2_32.dll", SetLastError=true)]

.

        set

.

        Native.setsockopt(socketPtr, Native.SocketOptionLevel.Socket, Native.SocketOptionName.ReceiveTimeout, ref optval, optlen);

.

    [DllImport("Ws2_32.dll", CharSet = CharSet.Unicode, EntryPoint = "InetNtopW")]

.

    [DllImport("Ws2_32.dll", CharSet = CharSet.Unicode, EntryPoint = "InetNtopW")]

.

    [DllImport("Ws2_32.dll", CharSet = CharSet.Ansi)]

.

    [DllImport("Ws2_32.dll", CharSet = CharSet.Ansi)]

.

   <System.Runtime.InteropServices.DllImport("ws2_32.dll", CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)>

.

    [DllImport("Ws2_32.dll", CharSet = CharSet.Unicode, EntryPoint = "InetPtonW")]

.

    [DllImport("Ws2_32.dll", CharSet = CharSet.Unicode, EntryPoint = "InetPtonW")]

10: ntohs
.

[DllImport("ws2_32.dll", SetLastError=true)]

11: select
.

        /* An optional pointer to a set of sockets to be checked for readability. */

.

        ref fd_set readfds,

.

        /* An optional pointer to a set of sockets to be checked for writability. */

.

        ref fd_set writefds,

.

        /* An optional pointer to a set of sockets to be checked for errors. */

.

        ref fd_set exceptfds,

.

    public static extern int setsockopt(IntPtr s, SocketOptionLevel level, SocketOptionName optname, ref int optval, int optlen);

.

Declare Function setsockopt Lib "ws2_32.dll" (TODO) As TODO

.

        set

.

        Native.setsockopt(socketPtr, Native.SocketOptionLevel.Socket, Native.SocketOptionName.ReceiveTimeout, ref optval, optlen);

.
Documentation
[setsockopt] on MSDN
.

    [DllImport("ws2_32.dll", CharSet = CharSet.Unicode, SetLastError = true)]

.
Summary
Enumerates all possible options used with getsockopt and setsockopt.
.

        /// Set/get IP options.

.

        /// Set/get IPv6 routing header.

.

        /// Set/get IPv6 hop-by-hop options.

.

        /// Set/get IPv6 protection level.

.

        /// Offset to checksum for raw IP socket send.

.

        /// Set/get IPv6 routing header.

.

        /// get/set the compartment for a socket

.

        /// Enables or disables the Nagle algorithm for TCP sockets. This option is disabled (set to FALSE) by default.

.

        /// (BSD) style (default) is used. This option can be set on the connection only once. Once this option is set on, this option cannot

.

        /// Enables or disables the Nagle algorithm for TCP sockets. This option is disabled (set to FALSE) by default.

.

        /// Set/get UDP-Lite checksum coverage

.

    [DllImport("Ws2_32.dll", CharSet = CharSet.Unicode, EntryPoint = "WSAAddressToStringW")]

.

    [DllImport("Ws2_32.dll", CharSet = CharSet.Unicode, EntryPoint = "WSAAddressToStringW")]

.

[DllImport("ws2_32.dll",CharSet = CharSet.Auto, SetLastError=true)]

.

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]

.

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]

.

[DllImport("ws2_32.dll", CharSet = CharSet.Auto)]

.
Summary
Open a dataset of network connections.
.

[DllImport("ws2_32.dll", CharSet = CharSet.Auto, SetLastError=true)]

.

static extern Int32 WSALookupServiceBegin(WSAQUERYSET lpqsRestrictions, Int32 dwControlFlags, ref Int32 lphLookup);

.

WSAQUERYSET

.
Summary
Close the dataset holding network connection info
.

[DllImport("ws2_32.dll", CharSet = CharSet.Auto, SetLastError=true)]

.

[DllImport("ws2_32.dll", CharSet = CharSet.Auto, SetLastError=true)]

.

        WSAQUERYSET lpRestrictions = new WSAQUERYSET();

.

            WSAQUERYSET qs = new WSAQUERYSET();

.

                qs = Marshal.PtrToStructure<WSAQUERYSET>(pqs);

.

[DllImport("ws2_32.dll", CharSet = CharSet.Auto, SetLastError=true)]

.

    public int iProtocolMaxOffset;

.

  [DllImport("ws2_32.dll", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.StdCall)]

.

[DllImport("ws2_32.dll", CharSet = CharSet.Auto, SetLastError=true)]

.

              CharSet = CharSet.Unicode,

fbwflib

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

The API defines an Void-Pointer as a parameter. The pointer must point to a function with 4 parameters itself. The parameters are the same as a WaitHandle with its initial state set to false. So you can use the SafeHandle of the ResetEvent class.

.

_manualResetEvent = new ManualResetEvent(false);

.

NativeMethods.FbwfCacheThresholdNotification((uint)100, _manualResetEvent.SafeWaitHandle);

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

[DllImport("fbwflib.dll", SetLastError=true)]

.

static extern uint FbwfSetCacheThreshold(

.

Declare Function FbwfSetCacheThreshold Lib "fbwflib.dll" (TODO) As TODO

.
Documentation
[FbwfSetCacheThreshold] on MSDN
.

[DllImport("fbwflib.dll", SetLastError=true)]

gsapi

.

    [DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]

.

    <DllImport("gsdll32.dll", CharSet:= CharSet.Ansi, CallingConvention:= CallingConvention.StdCall)> _

.

       [DllImport("gsdll32.dll",CharSet=CharSet.Ansi,CallingConvention=CallingConvention.StdCall)]

.

       <DllImport("gsdll32.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _

.

[DllImport("gsapi.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]

.

   [DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]

.

  <DllImport("gsdll32.dll", CharSet:= CharSet.Ansi, CallingConvention:= CallingConvention.StdCall)> _

.

    [DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]

.

    [DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]

.

    [DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]

.

    [DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]

.

    [DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]

.

    [DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]

misc

.

Great idea, thanks for setting it up!

.

One question: The APIs here appear to be machanically created from some other source - from things like "System.Windows.Forms.NativeMethods"? The functions are present, but not the structures and data types used in the params. Any plans to do a mechanical dump of the structures as well? The real magic of marshalling is getting the param types set up correctly, which for structures can be quite a pain.

.

[DllImport(“coredll.dll”, EntryPoint="CPAcquireContext", SetLastError=true)]

.

[DllImport(“advapi32.dll”, EntryPoint="CPAcquireContext", SetLastError=true)]

.

This site's been live for about a month, now -- either it's not getting indexed completely by Google, or there is nearly complete neglect for SetLastError=true. Or both.

.

http://www.google.com/search?q=SetLastError+site:pinvoke.net

.

http://www.windojitsu.com/blog/pleasesetlasterror.html

.

IMHO, the hardest part of developing a good p/invoke signature is not substituting "LPCSTR" with "string" -- it's looking up the failure semantics of the methods' return values... (NULL or INVALID_HANDLE? Does it SetLastError? etc.) And then wrapping the call appropriately.

.

I'd go so far as to recommend always mandating SetLastError -- explicitly setting SetLastError=false, to call out the (comparatively rare) Win32 functions that don't expose a failure path through GetLastError.

.

And SetLastError is only half the problem -- remembering to actually check the return value is the other half! We should compel folks to check the return values properly, in the sample usage section -- assert success and/or throw Win32Exception, as appropriate.

.

http://www.codeplex.com/managedwifi/SourceControl/DirectoryView.aspx?SourcePath=%24%2fmanagedwifi%2fWifiExample&changeSetId=17201

.

Discovered DISPLAY_DEVICE struct defined with CharSet=CharSet.Ansi. Works much better on Win7 with CharSet=CharSet.Auto. Suspect this is also true of a number of other structs and Win7 predecessors.

.

       [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]

.

    [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]

.
Note
this pages describes a work-around; the add-in setup still doesn't work of itself, which leaves users groping in the dark.
.

As long as the setup itself isn't updated, the PInvoke.net front page should not link to the setup directly, but to a page which describes the work-around. - Peter de Bruin

.

It would be nice to have a way to package/ associate a set of definitions together. So if say I were doing BITS programming I could get all the BITS interfaces quickly and easily. This of course would be built on top of the previously mentioned signature/class builder.

.
Import
advapi32,avifil32,cards,comdlg32,credui,crypt32,dmcl40,gdi32,gdiplus,glu32,glut32,gsapi,hhctrl,httpapi,icmp,imm32,iphlpapi,iprop,kernel32,mapi32,mpr,mqrt,mscorsn,msdrm,msi,msvcrt,netapi32,ntdll,ntdsapi,odbc32,odbccp32,ole32,oleacc,oleaut32,opengl32,powrprof,pstorec,query,rasapi32,rpcrt4,secur32,setupapi,shell32,shlwapi,twain_32,unicows,urlmon,user32,uxtheme,winfax,wininet,winmm,winscard,winspool,ws2_32,wtsapi32,xolehlp,aygshell,coredll,rapi,cfgmgr32,comctl32,hlink,Constants,Delegates,Enums,Interfaces,Structures,Glossary

winmm

.

    mciSendString("set CDAudio door open", returnstring,127, IntPtr.Zero);

.

     mciSendString("set CDAudio door open", rt, 127, IntPtr.Zero);

.

     mciSendString("set CDAudio door closed", rt, 127, IntPtr.Zero);

.

     mciSendString("set CDAudio door open", returnstring, 127, IntPtr.Zero)

.

    public uint offset;

.

[DllImport("winmm.dll", SetLastError = true)]

.

    [DllImport("winmm.dll", SetLastError = true)]

.

[DllImport("winmm.dll", SetLastError = true)]

.

[DllImport("winmm.dll", SetLastError=true)]

.
Summary
The midiInReset function stops input on a given MIDI input device
.

    [DllImport("winmm.dll", SetLastError = true)]

.

    static extern uint midiInReset(IntPtr hMidiIn);

.
Documentation
[midiInReset] on MSDN
.

[DllImport("winmm.dll", SetLastError = true)]

.

[DllImport("winmm.dll", SetLastError = true)]

.

    [DllImport("winmm.dll", SetLastError = true)]

.

[DllImport("winmm.dll", SetLastError=true)]

.

     int dwOffset;

.

     Dim dwOffset As Integer

.

      MIXER_SETCONTROLDETAILSF_VALUE = 0,

.

      MIXER_SETCONTROLDETAILSF_LISTTEXT = 1,

.

      MIXER_SETCONTROLDETAILSF_QUERYMASK = 0xF,

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


 
Access PInvoke.net directly from VS: