#!/usr/bin/perl use strict; use warnings; use Win32::API; #Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long Win32::API->Import( 'user32', 'long GetDC(long hWnd)', ); #Declare Function GetPixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long Win32::API->Import( 'gdi32', 'long GetPixel(long hdc, long x, long y)', ); sub PixelColor { my ($x, $y) = @_; my $dc = GetDC(''); my $rgb = sprintf "%06x", GetPixel(GetDC(''), $x, $y); return $rgb; } print PixelColor(100, 100), "\n";