Identify B&W screen

Last post 10-30-2002 14:54 by Anonymous. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 10-30-2002 14:54

    Identify B&W screen

    //=================================================
    [DllImport("coredll.dll")]
    internal static extern int GetDeviceCaps(
    IntPtr hdc,
    int nIndex);

    [DllImport("coredll.dll")]
    internal extern static IntPtr GetDC( IntPtr windowHandle );

    [DllImport("coredll.dll")]
    internal static extern int ReleaseDC(
    IntPtr hWnd,
    IntPtr hDC );

    internal const int BITSPIXEL = 12;

    public static bool IsMonoScreen()
    {
    //Get Screen DC
    IntPtr hDC = GetDC(IntPtr.Zero);

    //Get number of bits per pixel
    int ires = GetDeviceCaps(hDC, BITSPIXEL);

    ReleaseDC(IntPtr.Zero, hDC);

    //If it's less than 4 it should be a B&W
    if (ires > 4)
    return false;
    else
    return true;
    }
    //===========================================



    [8D]


    Alex Yakhnin, eMVP
    IntelProg, Inc.
    http://www.intelprog.com
Page 1 of 1 (1 items)