Hi...
Look, i try to do a little prog that just print a random pixels on the desktop and i have a little problem...
this is the code:
Code:'Module Public Declare Function SetPixel Lib "gdi32.dll" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long Public Declare Function GetDesktopWindow Lib "user32" () As Long Public Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As LongThis is the problem, the function don't work in the timer sub...Code:'This the Code... Private Sub Command1_Click() Dim DC As Long 'Get the DC DC = GetWindowDC(GetDesktopWindow) Randomize Timer Timer1.Enabled = True SetPixel DC, 100, 100, 200 'This is work just fine... End Sub Private Sub Command2_Click() Timer1.Enabled = False End Sub Private Sub Timer1_Timer() SetPixel DC, 100, 100, 200 'This, the same line! SetPixel DC, Rnd * 100,Rnd * 100, 200 '& This !!!Dont Work!!! End Sub
WHY ???
if you can help me... THANKS!




Reply With Quote