Hi,

I have used the SetPixel API to fill the screen with lines, i know i could use the MoveToEx, and LineTo api's but i need to set each pixel.

When it gets to about the 7th line the program crashes.

Here is the code i put in a module...





Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long

Sub Main()


For a = 1 To 1024 Step 10
For b = 1 To 768
SetPixel GetWindowDC(0), a, b, RGB(255, 0, 200)
DoEvents
Next b
SetPixel GetWindowDC(0), a, b, RGB(255, 0, 200)
DoEvents
Next a

End Sub






It also goes extremely slow!!!