@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The GetObject API !!!!C# Signature: [DllImport("gdi32.dll")] static extern int GetObject(IntPtr hgdiobj, int cbBuffer, IntPtr lpvObject); !!!!VB.NET Signature: <DllImport("gdi32.dll")> _ Private Shared Function GetObject(hgdiobj As IntPtr, cbBuffer As Integer, lpvObject As IntPtr) As Integer End Function !!!!User-Defined Types: None. !!!!Notes: Had a terrible time getting this to work to retrieve a BITMAP object from a HBITMAP, this code finally worked. (EDIT: Before going through all this check out the tips & tricks section for an official API to do this) BITMAP bmpScreen; GCHandle hndl = GCHandle.Alloc(bmpScreen, GCHandleType.Pinned); IntPtr ptrToBitmap = hndl.AddrOfPinnedObject(); GDI32.GetObject(hBitmap, Marshal.SizeOf<GDI32.BITMAP>(), ptrToBitmap); bmpScreen = Marshal.PtrToStructure<GDI32.BITMAP>(ptrToBitmap); hndl.Free(); !!!!Tips & Tricks: A better option than the above example would be to leverage Image.FromHbitmap Image.FromHbitmap Documentation on MSDN: https://msdn.microsoft.com/en-us/library/k061we7x !!!!Sample Code: Please add some! !!!!Alternative Managed API: Do you know one? Please contribute it! Documentation: GetObject@msdn on MSDN
Edit gdi32.getobject
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.