Help with error messages

This is a discussion on Help with error messages within the Windows Programming forums, part of the Platform Specific Boards category; The function below is supposed to take in integer x and y and then output the value of the pixel. ...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    43

    Help with error messages

    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 :-)

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    The variable XhdcScrn isn't declared anywhere.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21