How can I use Getpixel() on not active window?
Hi,
Someone on here maybe can help my to create a code: I need to get a Color of Pixel from not active Window.
What do I wrong? (Visual Studio 2005, Win XP SP2):
DeclareFunction FindWindowLib"user32"Alias"FindWindowA" (ByVal lpClassNameAsString,ByVal lpWindowNameAsString)AsIntegerDeclareFunction GetPixelLib"gdi32" (ByVal hdcAsInteger,ByVal xAsInteger,ByVal yAsInteger)AsIntegerDeclareFunction GetDCLib"user32" (ByVal hwndAsInteger)AsIntegerPublic dcAsIntegerPublic WHDCAsIntegerSub Main()WHDC = FindWindow("Forge9MDIClass","SONY SOUND FORGE 9.0")
' it is Sample. Class and Window Name isCorrect. whdc <>0
dc = GetDC(WHDC) ' dc <>0
Static colrAs UInt32
colr = GetPixel(dc, 803, 720) ' on that step i got message "Arithmetic operation resulted in an overflow",
' and programmstop.
MsgBox(colr)
EndSub
Can someone help my? Sorry for bad english.
This code work. But so a can get a pixel only from active window:
dc = GetDC(0)
Static colrAs UInt32
colr = GetPixel(dc, 803, 720)
MsgBox(colr)

