home *** CD-ROM | disk | FTP | other *** search
- /*
- PAINTRCT.C -- Demonstrates PaintRect
-
- From Chapter 6 of "Undocumented Windows" (Addison-Wesley 1992)
- by Andrew Schulman, Dave Maxey and Matt Pietrek
-
- Build using: WINIOBC PAINTRCT (for Borland C++ v3.00)
- WINIOMS PAINTRCT (for Microsoft C/SDK)
- */
-
- #include <windows.h>
- #include "wmhandlr.h"
- #include "winio.h"
-
- /* undocumented function */
- extern void FAR PASCAL PaintRect(HWND hwndParent, HWND hwnd,
- HDC hDC, HANDLE hBrush, LPRECT lpRect);
- #include "checkord.c"
-
-
- long dblclk(HWND hwnd, WORD wMsg, WORD wParam, DWORD lParam)
- {
- RECT rect;
- HDC hDC = GetDC(hwnd);
-
- GetClientRect(hwnd, (LPRECT) &rect);
- rect.left += 20;
- rect.right -= 20;
- rect.top += 10;
- rect.bottom -= 10;
- PaintRect(NULL, hwnd, hDC,
- GetStockObject(DKGRAY_BRUSH), (LPRECT) &rect);
- ReleaseDC(hwnd, hDC);
- puts("A rectangle in the window should now be dark gray");
- puts("Double click on a text line to do it again");
- return 1;
- }
-
-
- int main()
- {
- // Ord/name check
- if (! CheckOrdName("PaintRect", "USER", 325))
- return 0;
-
- winio_about("PAINTRCT"
- "\nDemonstrates PaintRect"
- "\n\nFrom Chapter 6 of"
- "\n\"Undocumented Windows\" (Addison-Wesley, 1992)"
- "\nby Andrew Schulman, David Maxey and Matt Pietrek"
- );
-
- wmhandler_set(winio_current(),
- WM_LBUTTONDBLCLK, (WMHANDLER) dblclk);
-
- puts("Double click on a text line to paint a dark gray rectangle");
- puts("Close the window to exit");
-
- return 0;
- }
-