Using the Timer for a Status Report

The final program in this chapter is something I alluded to in Chapter 5. It’s the only good use I’ve found for the GetPixel function.

WHATCLR (shown in Example 8-5) displays the RGB color of the pixel currently under the hot point of the mouse cursor.

Example 8-5. The WHATCLR program.

WHATCLR.C /*------------------------------------------ WHATCLR.C -- Displays Color Under Cursor (c) Charles Petzold, 1998 ------------------------------------------*/ #include <windows.h> #define ID_TIMER 1 void FindWindowSize (int *, int *) ; LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { static TCHAR szAppName[] = TEXT ("WhatClr") ...

Get Programming Windows®, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.