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

gdiplus

.

static extern int GdipAddPathArcI(HandleRef path, int x, int y, int width,

.

static extern int GdipAddPathBeziersI(HandleRef path, HandleRef memorypts,

.

static extern int GdipAddPathBezierI(HandleRef path, int x1, int y1,

.

static extern int GdipAddPathBeziers(HandleRef path, HandleRef memorypts,

.

static extern int GdipAddPathClosedCurveI(HandleRef path, HandleRef memorypts,

.

static extern int GdipAddPathClosedCurve2I(HandleRef path, HandleRef memorypts,

.

static extern int GdipAddPathCurveI(HandleRef path, HandleRef memorypts,

.

static extern int GdipAddPathCurve2I(HandleRef path, HandleRef memorypts,

.

static extern int GdipAddPathCurve3I(HandleRef path, HandleRef memorypts,

.

static extern int GdipAddPathEllipseI(HandleRef path, int x, int y,

.

static extern int GdipAddPathLineI(HandleRef path, int x1, int y1,

.

static extern int GdipAddPathLine2I(HandleRef path, HandleRef memorypts,

.

static extern int GdipAddPathPath(HandleRef path, HandleRef addingPath,

.

static extern int GdipAddPathPieI(HandleRef path, int x, int y,

.

static extern int GdipAddPathPolygonI(HandleRef path,

.

   HandleRef memorypts, int count);

.

static extern int GdipAddPathRectanglesI(HandleRef path,

.

   HandleRef rects, int count);

.

static extern int GdipAddPathRectangleI(HandleRef path, int x, int y,

.

static extern int GdipAddPathRectangles(HandleRef path,

.

   HandleRef rects, int count);

.

static extern int GdipAddPathStringI(HandleRef path, string s,

.

   int length, HandleRef fontFamily, int style, float emSize,

.

   ref GPRECT layoutRect, HandleRef format);

.

static extern int GdipBeginContainerI(HandleRef graphics,

.

static extern int GdipBeginContainer2(HandleRef graphics, out int state);

.

static extern int GdipBitmapGetPixel(HandleRef bitmap, int x, int y,

.

static extern int GdipBitmapLockBits(HandleRef bitmap, ref GPRECT rect,

.

static extern int GdipBitmapSetPixel(HandleRef bitmap, int x, int y, int argb);

.

static extern int GdipBitmapSetResolution(HandleRef bitmap, float dpix,

.

static extern int GdipBitmapUnlockBits(HandleRef bitmap,

.

static extern int GdipClearPathMarkers(HandleRef path);

.

   int height, int format, HandleRef srcbitmap, out IntPtr dstbitmap);

.

static extern int GdipCloneBrush(HandleRef brush, out IntPtr clonebrush);

.

static extern int GdipCloneCustomLineCap(HandleRef customCap, out IntPtr clonedCap);

.

static extern int GdipCloneFontFamily(HandleRef fontfamily,

.

static extern int GdipCloneImageAttributes(HandleRef imageattr,

.

static extern int GdipCloneMatrix(HandleRef matrix, out IntPtr cloneMatrix);

.

static extern int GdipClonePath(HandleRef path, out IntPtr clonepath);

.

static extern int GdipClonePen(HandleRef pen, out IntPtr clonepen);

.

static extern int GdipCloneRegion(HandleRef region, out IntPtr cloneregion);

.

static extern int GdipCloneStringFormat(HandleRef format, out IntPtr newFormat);

.

static extern int GdipClosePathFigures(HandleRef path);

.

static extern int GdipCombineRegionPath(HandleRef region, HandleRef path,

.

static extern int GdipCombineRegionRectI(HandleRef region,

.

static extern int GdipCombineRegionRegion(HandleRef region,

.

   HandleRef region2, CombineMode mode);

.

static extern int GdipComment(HandleRef graphics, int sizeData, byte[] data);

.

   HandleRef graphics, out IntPtr bitmap);

.

static extern int GdipCreateBitmapFromHBITMAP(HandleRef hbitmap,

.

   HandleRef hpalette, out IntPtr bitmap);

.

static extern int GdipCreateBitmapFromHICON(HandleRef hicon, out IntPtr bitmap);

.

static extern IntPtr GdipEmfToWmfBits(HandleRef hEmf, uint uBufferSize,

.

internal static extern int GdipMeasureString(HandleRef graphics, string textString, int length, HandleRef font, ref GPRECTF layoutRect, HandleRef stringFormat, [In, Out] ref GPRECTF boundingBox, out int codepointsFitted, out int linesFilled);

shell32

.

        public static extern IntPtr SendMessage(HandleRef hWnd, uint Msg, int wParam, IntPtr lParam);

.

        public static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, string lParam);

.

                //Win32.SendMessage(new HandleRef(null, hWnd), BFFM_SETSELECTIONA, 1, lpData);

.

                SendMessage(new HandleRef(null, hWnd), BFFM_SETSELECTIONW, 1, _initialPath);

.

                SendMessage(new HandleRef(null, hWnd), BFFM_SETSTATUSTEXTW, 0, pathPtr);

gdi32

.

       //Remember to use HandleRef when appropriate. For instance if you create

.

       //use a HandleRef.

Interfaces

.

             HandleRef hwndParent,

user32

.

static extern bool BringWindowToTop(HandleRef hWnd);

.

public static IntPtr GetClassLongPtr(HandleRef hWnd, int nIndex)

.

public static extern uint GetClassLongPtr32(HandleRef hWnd, int nIndex);

.

public static extern IntPtr GetClassLongPtr64(HandleRef hWnd, int nIndex);

.

Public Shared Function GetClassLongPtr(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr

.

Public Shared Function GetClassLongPtr32(ByVal hWnd As HandleRef, <MarshalAs(UnmanagedType.I4)>nIndex As ClassLongFlags) As UInteger

.

Public Shared Function GetClassLongPtr64(ByVal hWnd As HandleRef, <MarshalAs(UnmanagedType.I4)>nIndex As ClassLongFlags) As IntPtr

.

public static IntPtr GetClassLongPtr(HandleRef hWnd, int nIndex)

.

public static extern uint GetClassLongPtr32(HandleRef hWnd, int nIndex);

.

public static extern IntPtr GetClassLongPtr64(HandleRef hWnd, int nIndex);

.

Public Shared Function GetClassLongPtr(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr

.

Public Shared Function GetClassLongPtr32(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As UInteger

.

Public Shared Function GetClassLongPtr64(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr

.

Private Shared Function GetWindowLongPtr(ByVal hWnd As HandleRef, <MarshalAs(UnmanagedType.I4)>nIndex As WindowLongFlags) As IntPtr

.

Private Shared Function GetWindowLongPtr(ByVal hWnd As HandleRef, <MarshalAs(UnmanagedType.I4)>nIndex As WindowLongFlags) As IntPtr

.

Private Shared Function GetWindowLongPtr32(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr

.

Private Shared Function GetWindowLongPtr64(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr

.

Public Shared Function GetWindowLongPtr(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr

.

You might want to declare the first parameter as HandleRef rather than IntPtr.

.

Private Shared Function GetWindowLongPtr(ByVal hWnd As HandleRef, <MarshalAs(UnmanagedType.I4)>nIndex As GWL) As IntPtr

.

Private Shared Function GetWindowLongPtr(ByVal hWnd As HandleRef, <MarshalAs(UnmanagedType.I4)>nIndex As GWL) As IntPtr

.

Private Shared Function GetWindowLongPtr32(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr

.

Private Shared Function GetWindowLongPtr64(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr

.

Public Shared Function GetWindowLongPtr(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr

.

You might want to declare the first parameter as HandleRef rather than IntPtr.

.

Private Shared Function GetWindowRect(ByVal hWnd As HandleRef, ByRef lpRect As RECT) As Boolean

.

static extern bool GetWindowRect(HandleRef hWnd, out RECT lpRect);

.

     if(!GetWindowRect(new HandleRef(this, this.Handle), out rct ))

.
Summary
A HandleRef is essentially an IntPtr to a handle and a reference to the object the handle belongs to. Using HandleRef prevents the GC from collecting the object until the native method is done with it.
.

HandleRef handle;

.

HandleRef is only needed when there's a chance the Garbage Collector will collect the object the handle refers to.

.

When to use HandleRef

.
Documentation
[HandleRef] on MSDN
.

static extern bool PeekMessage(out NativeMessage lpMsg, HandleRef hWnd, uint wMsgFilterMin,

.

Specifying HandleRef instead of IntPtr as the hWnd type prevents the object the handle referees to from being garbage collected. All internal Microsoft PInvokes use HandleRef and not IntPtr.

.

    new HandleRef(myWindow,myWindow.hWnd),

.

static extern bool PostMessage(HandleRef hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

.

    void PostMessageSafe( HandleRef hWnd, uint msg, IntPtr wParam, IntPtr lParam )

.

public static IntPtr SetClassLong(HandleRef hWnd, int nIndex, IntPtr dwNewLong)

.

public static extern uint SetClassLongPtr32(HandleRef hWnd, int nIndex, uint dwNewLong);

.

public static extern IntPtr SetClassLongPtr64(HandleRef hWnd, int nIndex, IntPtr dwNewLong);

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


 
Access PInvoke.net directly from VS: