PDA

Click to See Complete Forum and Search --> : RGB color and Mouse


DaoK
Jun 26th, 2001, 12:55 PM
I want to make a program than the person add in a text box color they want in RGB (Exemple 255,255,255). And In a timer I want The mouse go search ( have the focus) in the screen (desktop, icon, all windows open) the colors choosen.

IS it posible?

DaoK
Jun 27th, 2001, 03:32 PM
This is what I did for moment :



'Module
Public Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long

'Declaration


Private Declare Function GetCursorPos Lib "user32" (lpPoint As PointAPI) As Long
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Type PointAPI
x As Long
y As Long
End Type
Private Pos As PointAPI

'Form

Private Sub Form_Load()
Label1.BackColor = RGB(150, 200, 175)
End Sub

Private Sub Timer1_Timer()
alphaX = RGB(150, 200, 175)
alphaY = RGB(150, 200, 175)
GetCursorPos Pos
Caption = Pos.x - (Left / Screen.TwipsPerPixelX) & "," & Pos.y - (Top / Screen.TwipsPerPixelY)
SetCursorPos alphaX, alphaY
End Sub



Of course that doesnt work and I put a label just for the test becasue I want that work anywhere after.
Please help me