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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.