The function below is supposed to take in integer x and y and then output the value of the pixel.
Can someone please help identify the cause of the 2 error messages:
Building getpixel.obj.
C:\Documents and Settings\christopher\Desktop\getpixel.c(16): error #2048: Undeclared identifier 'XhdcScrn'.
C:\Documents and Settings\christopher\Desktop\getpixel.c(16): error #2168: Operands of = have illegal types 'int' and 'struct HDC__ *'.
*** Error code: 1 ***
Done.
Code:
#include <stdio.h>
#include <windows.h>
#include <wingdi.h>
#include <winuser.h>
//get colour of specific pixel
int getpix(int x, int y){
COLORREF clr;
HDC hdcScrn;
XhdcScrn=CreateDC("DISPLAY",0,0,0);
clr=GetPixel(hdcScrn,x,y);
DeleteDC(hdcScrn);
printf("%i", clr);
return clr;
}
Thankyou :-)