-
Sep 1st, 2012, 08:26 AM
#1
New Member
getpixel() returns -1
Hi all
This is part of my code:
Option Explicit
Private Declare Function GetPixel Lib "GDI32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Sub CommandButtonGenerate_Click()
Dim RefPath As String
RefPath = CommonDialogDraw.Filename
ImageRef.Picture = LoadPicture(RefPath)
MsgBox GetPixel(ImageStud.Picture.Handle, 5, 5)
End sub
The getpixel() in my code keeps returning -1. I tried to google and many mentioned that we have to set to vbpixels. Thus i added in this line:
ImageRef.Picture.ScaleMode = vbPixels
But an error "Variable vbPixels is not defined" keeps coming up.
What am i missing? Do i have to declare anything else? I am using VBA.
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules