i know how to do it if its allready displayed by using GetPixel api. but how can I get first pixel position of a bitmap in memory.
Printable View
i know how to do it if its allready displayed by using GetPixel api. but how can I get first pixel position of a bitmap in memory.
I usually use GetObjectA to get Bitmap information
vb Code:
Option Explicit Private Type BITMAP '24 bytes Type As Long Width As Long Height As Long WidthBytes As Long Planes As Integer BitsPixel As Integer Bits As Long End Type Private Declare Function GetObjectAPI Lib "gdi32" Alias "GetObjectA" ( _ ByVal hObject As Long, ByVal nCount As Long, ByRef lpObject As Any) As Long Sub TestGetObjectAPI(hBmp) Dim BM As BITMAP GetObjectAPI hBmp, 24, BM With BM Debug.Print .Width Debug.Print .Height Debug.Print .BitsPixel Debug.Print .WidthBytes 'includes any padding 'Size of the pixel data = WidthBytes * Height Debug.Print .Bits '<-- the address of the pixel data End With End Subvb Code:
Call TestGetObjectAPI(Me.Picture.handle)