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

ws2_32

.

    public static extern IntPtr accept(IntPtr s, IntPtr addr, int addrsize);

2: bind
.

    public static extern int bind(IntPtr s, ref sockaddr_in addr, int addrsize);

.

    public static extern int bind(IntPtr s, ref sockaddr_in6 addr, int addrsize);

.

                    Marshal.SizeOf(remoteAddress));

.

    public static extern int connect(IntPtr s, ref sockaddr_in addr, int addrsize);

.

    public static extern int connect(IntPtr s, ref sockaddr_in6 addr, int addrsize);

.

    public static extern uint InetNtop(ADDRESS_FAMILIES Family, ref in_addr pAddr, StringBuilder pStringBuf, int StringBufSize);

.

    public static extern uint InetNtop(ADDRESS_FAMILIES Family, ref in6_addr pAddr, StringBuilder pStringBuf, int StringBufSize);

.

        var infoSize = Marshal.SizeOf(BufferRet);

.

        var handle = Marshal.AllocHGlobal(infoSize);

.

            handle, infoSize,

.

        /// send buffer size

.

        /// receive buffer size

.

        /// maximum message size

.

        SO_MAX_MSG_SIZE         =   0x2003,

.

    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 257)]

.

    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 129)]

.

    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 257)]

.

    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 129)]

.

        /* reference to receive Size */

.

        var infoSize = Marshal.SizeOf(BufferRet);

.

        var handle = Marshal.AllocHGlobal(infoSize);

.

            handle, infoSize,

.

        lpRestrictions.dwSize = Marshal.SizeOf(lpRestrictions);

.

    public int dwMessageSize;

.

    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 255 /* WSAPROTOCOL_LEN */ + 1)]

.

    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7 /* MAX_PROTOCOL_CHAIN */)]

.

        // send buffer size  

.

        // receive buffer size  

.

        // maximum message size  

.

        SO_MAX_MSG_SIZE = 0x2003,

.
  • socketAddressSize: A pointer to the length, in bytes, of the buffer pointed to by the lpAddress parameter.
.

        int sockAddrSize = Marshal.SizeOf(sockAddr);

.

        ref sockAddrSize);

.

    pSockAddr = Marshal.AllocHGlobal(Marshal.SizeOf(sockAddr));

fbwflib

.
Summary
Signals an event when the available write cache falls below a specified size.
.

     ref  UInt32 size);

.

uint size = 100;

.

var pBuffer = Marshal.AllocHGlobal((int)size);

.

var returnCode = NativeFbwfMethods.FbwfGetExclusionList(protectedVolume, true, pBuffer, ref size);

.

     ref  UInt32 size);

.

uint size = 100;

.

var pBuffer = Marshal.AllocHGlobal((int)size);

.

NativeMethods.FbwfGetVolumeList(true, pBuffer, ref size);

gsapi

.

        gsapi_revision(ref version, Marshal.SizeOf(version));

.

    Declare Auto Function gsapi_revision Lib "gsdll32.dll" (ByRef pVer As GSVersion, ByVal pSize As Integer) As Integer

.

        gsapi_revision(ref gsVer, Marshal.SizeOf(gsVer));

.

    lResult = gsapi_revision(lVer, Marshal.SizeOf(lVer))

misc

.

DWORD __stdcall CodecRead(int hRadio, void *Buf, DWORD Size);

19: FAQ
.

For pointer-sized entities such as handles, they must be defined such that they will be 32 bits on a 32-bit machine and 64 bits on a 64-bit machine. IntPtr (or UIntPtr) accomplishes this. The use of int will appear to be fine if you only run the code on a 32-bit machine, but will likely cause your application/component to crash as soon as it gets on a 64-bit machine.

winmm

.

static extern Int32 mciGetErrorString(Int32 errorCode, StringBuilder errorText, Int32 errorTextSize);

.

Public Declare Auto Function mciGetErrorString Lib "winmm.dll" (ByVal errorCode As Integer, ByRef errorText As StringBuilder, ByVal errorTextSize As Integer) As Integer

.

static extern Int32 mciSendString(string command, StringBuilder buffer, int bufferSize, IntPtr hwndCallback);

.

Private Shared Function mciSendString(ByVal command As String, ByVal buffer As StringBuilder, ByVal bufferSize As Integer, ByVal hwndCallback As IntPtr) As Integer

.

Declare Ansi Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal command As String, ByRef buffer As StringBuilder, ByVal bufferSize As Integer, ByVal hWndCallback As IntPtr) As Integer

.

static extern Int32 mciSendString(string command, string buffer, int bufferSize, IntPtr hwndCallback);

.

    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]

.

Use (uint)Marshal.SizeOf(typeof(MIDIINCAPS)) for cbMidiInCaps.

.

    [MarshalAs(UnmanagedType.ByValTStr, SizeConst= 32)]

.

int result = midiOutGetDevCaps(deviceID, ref outCaps, Marshal.SizeOf(outCaps));

.

Use (uint)Marshal.SizeOf(typeof(MIDIOUTCAPS)) for cbMidiOutCaps.

.

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]

.

        midiOutGetDevCaps((UIntPtr) x, out caps, (uint)Marshal.SizeOf(typeof(MIDIOUTCAPS)));

.

     /// <summary>size in bytes of MIXERCONTROLDETAILS</summary>

.

     public UInt32 StructSize

.

     /// <summary>size of _one_ details_XX struct</summary>

.

     public UInt32 DetailsItemSize

.

   private static extern uint MixerGetDevCaps(int mixerId, ref MixerCaps mixerCaps, int mixerCapsSize);

.

   Private Shared Function MixerGetDevCaps(ByVal mixerId As Integer, ByRef mixerCaps As MixerCaps, ByVal mixerCapsSize As Integer) As UInteger

.

       private static extern uint MixerGetDevCaps(int mixerId, ref MixerCaps mixerCaps, int mixerCapsSize);

.

           [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]

.

           uint result = MixerGetDevCaps(mixerId, ref caps, Marshal.SizeOf(caps));

.

     [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MixerXPNative.MIXER_SHORT_NAME_CHARS)]

.

     [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MixerXPNative.MIXER_LONG_NAME_CHARS)]

.

     /// <summary>size in bytes of <see cref="MIXERCONTROL">MIXERCONTROL</see></summary>

.

     public UInt32 StructSize

.

     /// <summary>size in bytes of custom data</summary>

.

            UInt32 sizeTimeCaps );

.

Declare Function timeGetDevCaps Lib "winmm.dll" (ByRef lpTimeCaps As TimeCaps, ByVal uSize As UInt32) As UInt32

.

static extern UInt32 timeGetSystemTime( ref MmTime mmTime, UInt32 sizeMmTime );

.

ByVal uSize As Integer) As Integer

.

     <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=32)> _

.

     [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 32)]

.

Remember to have the strings marshaled as ByValTStr with size of 32.

.

         waveOutGetDevCaps(i, wc, System.Runtime.InteropServices.Marshal.SizeOf(wc))  

.

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]

.

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]

.

            waveOutGetDevCaps(uDeviceID, ref waveOutCaps, Marshal.SizeOf(typeof(WAVEOUTCAPS)));

.

            waveInGetDevCaps(uDeviceID, ref waveInCaps, Marshal.SizeOf(typeof(WAVEINCAPS)));

.

      /// <param name="cchText">The size of the string</param>

.

See http://social.msdn.microsoft.com/Forums/en-US/windowspro-audiodevelopment/thread/14926e01-635e-4360-998b-ec6124d888a7 - correct C# signature at the bottom (including uDeviceId). This is based on http://msdn.microsoft.com/en-us/library/windows/desktop/dd743866%28v=vs.85%29.aspx which shows a UINT_PTR for that parameter. Note that the _PTR parameters are the only ones that are different sizes in 32 vs. 64 bit mode. In .Net you use IntPtr for that purpose.

.

  public static extern uint waveOutPrepareHeader(IntPtr hWaveOut, IntPtr pwh, int uSize);

.

    waveHdrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(waveHdr));

.

    waveHdr.dwBufferLength = wf.nSamplesPerSec * wf.nBlockAlign;  // it's size

.

    if ((MMRESULT = waveOutPrepareHeader(waveDevice, waveHdrPtr, Marshal.SizeOf(waveHdr))) != MMSYSERR_NOERROR)

.

    if ((MMRESULT = waveOutWrite(waveDevice, waveHdrPtr, Marshal.SizeOf(waveHdr))) != MMSYSERR_NOERROR)

.

    if ((MMRESULT = waveOutUnprepareHeader(waveDevice, waveHdrPtr, Marshal.SizeOf(waveHdr))) != MMSYSERR_NOERROR)

comctl32

.

        Dim cbSize As UInt32

.

        Dim pnt As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(rect))

.

        SetReaderModeInfo.cbSize = Marshal.SizeOf(SetReaderModeInfo)

.

       /// <param name="bounds">The bounds in which to draw the image. Set width and height to 0 to draw image at full size.</param>

.

static extern bool ImageList_GetIconSize(IntPtr himl, out int cx, out int cy);

.

Declare Function ImageList_GetIconSize Lib "comctl32.dll" (TODO) As TODO

.

Private Shared Function ImageList_GetIconSize(himl As IntPtr, ByRef cx As Integer, ByRef cy As Integer) As Boolean

.

        ImageList_GetIconSize(himl,out iconWidth,out iconHeight);

.
Documentation
[ImageList_GetIconSize] on MSDN
.

static extern bool ImageList_GetIconSize(IntPtr himl, out int cx, out int cy);

.

Declare Function ImageList_GetIconSize Lib "comctl32.dll" (TODO) As TODO

.

        ImageList_GetIconSize(himl,out iconWidth,out iconHeight);

.
Documentation
[ImageList_GetIconSize] on MSDN
.

static extern bool ImageList_SetIconSize(IntPtr hImageList, int cx, int cy);

.

Declare Function ImageList_SetIconSize Lib "comctl32.dll" (ByVal hImageList As IntPtr, ByVal cx As Integer, ByVal cy As Integer) As Boolean

.
Documentation
[ImageList_SetIconSize] on MSDN
.

       /// <param name="bounds">The bounds in which to draw the image. Set width and height to 0 to draw image at full size.</param>

.

        public uint cbSize;

.

        public uint cbSize;

shell32

.

    //        DWORD cbSize;

.

    public static readonly int cbSize = Marshal.SizeOf(typeof(APPBARDATA));

.

    public int cbSize; // initialize this field using: Marshal.SizeOf(typeof(APPBARDATA));

.

    Public cbSize As Integer

.

Initialy the C# signature in this article used a public static readonly int for cbSize so it could be initialized inline but the static field is then no longer where you expect it to be in memory so the call to SHAppBarMessage() fails. The field cannot be static.

.

If you want a single line way to get an APBARDATA with the cbSize field initialized then you can add a public static method as follows:

.

    public int cbSize; // initialize this field using: Marshal.SizeOf(typeof(APPBARDATA));

.

      abd.cbSize = Marshal.SizeOf(typeof(APPBARDATA));

.

                    Marshal.ReadIntPtr(ptrToSplitArgs, i * IntPtr.Size));

.

If Not IntPtr.Zero.Equals( ItemIDList ) Then Return New IntPtr(If(IntPtr.Size = 4, ItemIDList.ToInt32, ItemIDList.ToInt64))

.

    public int cbSize;

.

    Dim cbSize As Integer

.

    public int cbSize;

.

    Dim cbSize As Integer

.

static extern uint DoEnvironmentSubst(StringBuilder pszString, uint cbSize);

.

Another method must be used to aquire other icon sizes.

.

To get other sizes of an icon, check sample at http://pinvoke.net/default.aspx/user32/LoadImage.html

.

To get other sizes of an icon, check sample at http://pinvoke.net/default.aspx/user32/LoadImage.html

.

    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]

.

///         <description>Requests a size and screen position for an appbar.</description>

.

///         <description>Sets the size and screen position of an appbar.</description>

.

    Private DockSize As Size

.

    Public cbSize As Integer

.

    Public T_SIZE As RECT

.

    Public Property AppBarDockSize() As Size

.

        Return DockSize

.

    Set(ByVal Value As Size)

.

        DockSize = Value

.

    Friend Sub New(ByRef DockForm As System.Windows.Forms.Form, ByVal dockStyle As AppBarDockStyle, ByVal AppBarSize As Size)

.

    AppBarDockSize = AppBarSize

.

    Friend Sub RegisterBar(ByVal hWnd As IntPtr, ByRef uCallbackMessage As Int32, ByVal idealSize As Size, ByVal DockEdge As ABEdge)

.

    abd.cbSize = Marshal.SizeOf(abd)

.

    ABSetPos(hWnd, idealSize, DockEdge)

.

    abd.cbSize = Marshal.SizeOf(abd)

.

    Friend Sub ABSetPos(ByVal hWnd As IntPtr, ByVal idealSize As Size, ByVal DockEdge As ABEdge)

.

    abd.cbSize = Marshal.SizeOf(abd)

.

        abd.rc.bottom = SystemInformation.PrimaryMonitorSize.Height

.

        abd.rc.right = idealSize.Width

.

        abd.rc.right = SystemInformation.PrimaryMonitorSize.Width

.

        abd.rc.left = abd.rc.right - idealSize.Width

.

        abd.rc.right = SystemInformation.PrimaryMonitorSize.Width

.

        abd.rc.bottom = idealSize.Height

.

        abd.rc.bottom = SystemInformation.PrimaryMonitorSize.Height

.

        abd.rc.top = abd.rc.bottom - idealSize.Height

.

        abd.rc.right = abd.rc.left + idealSize.Width

.

        abd.rc.left = abd.rc.right - idealSize.Width

.

        abd.rc.bottom = abd.rc.top + idealSize.Height

.

        abd.rc.top = abd.rc.bottom - idealSize.Height

.

    abd.cbSize = Marshal.SizeOf(abd)

.

    Dim state As Long, tsize As Long

.

        ABD.cbSize = Marshal.SizeOf(ABD)

.

        tsize = SHAppBarMessage(CType(ABMsg.ABM_GETTASKBARPOS, Integer), ABD)

.

        retState.T_SIZE = ABD.rc

.

        [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)]

.

        [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)]

.

    [ StructLayout( LayoutKind.Explicit, Size=128 )]

.

    [StructLayout(LayoutKind.Explicit, Size=520)]

.

        private uint BIF_NEWDIALOGSTYLE     = 0x0040;   // Use the new dialog layout with the ability to resize

.

                IntPtr pathPtr = Marshal.AllocHGlobal((int)(260 * Marshal.SystemDefaultCharSize));

.

    Public cbSize As Integer

.

        public int cbSize;

.

info.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(info)

.

    info.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(info);

.

sei.cbSize = Marshal.SizeOf(sei)

.

        public uint cbSize;

.

        notifyIcon.cbSize = (uint)Marshal.SizeOf(notifyIcon.GetType());

.

        public uint cbSize;

.

        notifyIcon.cbSize = (uint)Marshal.SizeOf(notifyIcon.GetType());

.

     [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]

.

     [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]

.

      [MarshalAs(UnmanagedType.ByValTStr, SizeConst=MAX_PATH)]

.

      [MarshalAs(UnmanagedType.ByValTStr, SizeConst=MAX_TYPE)]

.

      /// <summary>get shell size icon</summary>

.

      ShellIconSize     = 0x000000004,  

.

        int cbFileInfo = Marshal.SizeOf(info);

.

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]

.

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]

.

        public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags);

.

        IntPtr hImgSmall = Win32.SHGetFileInfo(fileName, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | flags);

.

Please note also that it returns a 32x32 icon with the default (lowest) resolution, which is resized by Windows if you display it as 16x16, the result being that it looks horrible.

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


 
Access PInvoke.net directly from VS: