BrakePad44
03-24-2004, 05:38 AM
Is there any way in which i can make a pixel change colour on the screen, wherever the mouse moves? I have tried doing a search for different API, but cant find the change pixel colour.
Printing a Pixel on the screenBrakePad44 03-24-2004, 05:38 AM Is there any way in which i can make a pixel change colour on the screen, wherever the mouse moves? I have tried doing a search for different API, but cant find the change pixel colour. sseller 03-24-2004, 05:45 AM If you mean on a form or picturebox, then the PSET method will set a single pixel's colour if the DrawWidth property is 1. Is there any way in which i can make a pixel change colour on the screen, wherever the mouse moves? I have tried doing a search for different API, but cant find the change pixel colour. malloc 03-24-2004, 05:52 AM If you mean anywhere on the screen, you probably need the SetPixel API function. Malloc BrakePad44 03-24-2004, 06:28 AM Yeah, i tried that, but i think its for .net, and i dont have that! Any ideas for VB without .NET? Mad_Kitten 03-24-2004, 06:33 AM It is not only for .net. Have you used an API-function before? Follow this link:SetPixel. There is also a tutorial on API on that site BrakePad44 03-24-2004, 06:46 AM I have used API B4, can u c anything wrong with this?: vb: Private Type POINTAPI X As Long Y As Long End Type Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long Const Yellow = &HFFFF& Private Sub Form_Load() Dim Point As POINTAPI Me.AutoRedraw = True Me.ScaleMode = vbPixels End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetPixel Form1.hdc, X, Y, Yellow End Sub Nothing happens on a mouse move Mad_Kitten 03-24-2004, 06:56 AM This is a quote from Passel in a previous thread. With AutoRedraw set True, the .hDC property should refer to the .image buffer in memory and you won't pickup an image from the screen. But if you use GetDC, the DC returned will be the DC refering to the Screen image of the picturebox, regardless of the state of AutoRedraw, so will pickup anything overlaying it's client area.So add Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long to the declaration and replace form.hDc by GetDC(form.hwnd) in your code BrakePad44 03-24-2004, 07:00 AM Quality - That works Perfectly - Cheers for all ur Help Mad Kitten! |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum