设为首页 加入收藏

TOP

计时器(二十六)
2010-12-30 21:12:14 】 浏览:24057
Tags:计时器
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}

void FindWindowSize (int * pcxWindow, int * pcyWindow)
{
HDC hdcScreen ;
TEXTMETRIC tm ;

hdcScreen = CreateIC (TEXT ("DISPLAY"), NULL, NULL, NULL) ;
GetTextMetrics (hdcScreen, &tm) ;
DeleteDC (hdcScreen) ;

* pcxWindow = 2 * GetSystemMetrics (SM_CXBORDER) +
12 * tm.tmAveCharWidth ;
* pcyWindow = 2 * GetSystemMetrics (SM_CYBORDER) +
GetSystemMetrics (SM_CYCAPTION) +
2 * tm.tmHeight ;
}

LRESULT CALLBACK WndProc ( HWND hwnd, UINT message, WPARAM wParam,LPARAM lParam)
{
static COLORREF cr, crLast ;
static HDC hdcScreen ;
HDC hdc ;
PAINTSTRUCT ps ;
POINT pt ;
RECT rc ;
TCHAR szBuffer [16] ;

switch (message)
{
case WM_CREATE:
hdcScreen = CreateDC (TEXT ("DISPLAY"), NULL, NULL, NULL) ;
SetTimer (hwnd, ID_TIMER, 100, NULL) ;
return 0 ;

case WM_TIMER:
GetCursorPos (&pt) ;
cr = GetPixel (hdcScreen, pt.x, pt.y) ;

SetPixel (hdcScreen, pt.x, pt.y, 0) ;

if (cr != crLast)
{
crLast = cr ;
InvalidateRect (hwnd, NULL, FALSE) ;
}
return 0 ;

case WM_PAINT:
hd
首页 上一页 23 24 25 26 27 下一页 尾页 26/27/27
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇子视窗控制项 下一篇滑鼠

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目