Please help guys,
Picture1.hdc is returning a different value than GetDC(Picture1. hwnd)
Look at the source code I've provided. This doesn't make any sense! I need help!
[CODE=vb]Option Explicit
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Sub Form_Load()
Dim lngHDC As Long
MsgBox "Picture1.h dc value = " & Picture1.hdc
lngHDC = GetDC(Form1.Pic ture1.hwnd)
MsgBox "GetDC value = " & lngHDC
'Get the color
MsgBox GetPixel(lngHDC , 1, 1)
End Sub[/CODE]
I need this to be fixed because I NEED that last line of code to be ran just the way it is, unfortunately. In my program, objects are being created, api's are being used, etc, all of it combined does not allow me to just write GetPixel(pictur e1.hdc, 1, 1).
Picture1.hdc is returning a different value than GetDC(Picture1. hwnd)
Look at the source code I've provided. This doesn't make any sense! I need help!
[CODE=vb]Option Explicit
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Sub Form_Load()
Dim lngHDC As Long
MsgBox "Picture1.h dc value = " & Picture1.hdc
lngHDC = GetDC(Form1.Pic ture1.hwnd)
MsgBox "GetDC value = " & lngHDC
'Get the color
MsgBox GetPixel(lngHDC , 1, 1)
End Sub[/CODE]
I need this to be fixed because I NEED that last line of code to be ran just the way it is, unfortunately. In my program, objects are being created, api's are being used, etc, all of it combined does not allow me to just write GetPixel(pictur e1.hdc, 1, 1).
Comment