O'Reilly logo

Programming Windows®, Fifth Edition by Charles Petzold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required