• 大小: 722.72 KB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2024-08-04
  • 语言: 其他
  • 标签:

资源简介

桌面显示时间小程序。

资源截图

代码片段和文件信息

#include 
#include “resource.h“
LRESULT CALLBACK WinTimeProc(
  HWND hwnd 
  UINT uMsg 
  WPARAM wParam 
  LPARAM lParam 
); 

int WINAPI WinMain(
  HINSTANCE hInstance 
  HINSTANCE hPrevInstance 
  LPSTR lpCmdLine 
  int nShowCmd 

{

WNDCLASS ws;
ws.cbClsExtra=0;
ws.cbWndExtra=0;
ws.hbrBackground=(HBRUSH)::GetStockobject(BLACK_BRUSH);
ws.hCursor=::LoadCursor(hInstanceIDC_SIZENESW);
ws.hIcon=::LoadIcon(hInstance(LPSTR)IDI_ICON1);
ws.hInstance=hInstance;
ws.lpfnWndProc=WinTimeProc;
ws.lpszClassName=“DeskTime“;
ws.lpszMenuName=NULL;
ws.style=CS_VREDRAW | CS_HREDRAW;
RegisterClass(&ws);
HWND hwnd;
hwnd=CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW“DeskTime““七黑黑“WS_POPUP8804013030
NULLNULLhInstanceNULL);
ShowWindow(hwndSW_SHOW);
UpdateWindow(hwnd);
SetTimer(hwnd11000NULL);
MSG msg;
while(GetMessage(&msgNULL00))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WinTimeProc(
  HWND hwnd 
  UINT uMsg 
  WPARAM wParam 
  LPARAM lParam 

{
SYSTEMTIME sm;
char ch[20];
GetLocalTime(&sm);
switch(uMsg)
{
case WM_PAINT:
PAINTSTRUCT ps;
wsprintf(ch“%.2d:%.2d:%.2d  %.2d-%.2d  %d“sm.wHour
sm.wMinutesm.wSecondsm.wMonthsm.wDaysm.wDayOfWeek);
HDC hdc;
hdc=BeginPaint(hwnd&ps);
SetBkColor(hdcRGB(111));
SetTextColor(hdcRGB(255255255));
TextOut(hdc66chstrlen(ch));
EndPaint(hwnd&ps);
break;
case WM_TIMER:
HDC hdc1;
hdc1=::GetDC(hwnd);
wsprintf(ch“%.2d:%.2d:%.2d  %.2d-%.2d  %d“sm.wHour
sm.wMinutesm.wSecondsm.wMonthsm.wDaysm.wDayOfWeek);
SetBkColor(hdc1RGB(111));
SetTextColor(hdc1RGB(255255255));
TextOut(hdc166chstrlen(ch));
ReleaseDC(hwndhdc1);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CHAR:
if(113==wParam)
{
SendMessage(hwndWM_CLOSE00);
}
default:
return DefWindowProc(hwnduMsgwParamlParam);
}
return 0;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3124  2008-07-17 08:02  WinTime\Debug\recourse.res

     文件     189440  2008-07-18 07:53  WinTime\Debug\vc60.idb

     文件     135168  2008-07-18 07:53  WinTime\Debug\vc60.pdb

     文件    1917952  2008-07-18 07:53  WinTime\Debug\WinTime.bsc

     文件     163904  2008-07-18 07:53  WinTime\Debug\WinTime.exe

     文件     209180  2008-07-18 07:53  WinTime\Debug\WinTime.ilk

     文件      15159  2008-07-18 07:53  WinTime\Debug\WinTime.obj

     文件     435200  2008-07-18 07:53  WinTime\Debug\WinTime.pdb

     文件       3124  2008-07-16 23:04  WinTime\Debug\WinTime.res

     文件          0  2008-07-18 07:53  WinTime\Debug\WinTime.sbr

     文件       2998  2008-07-15 22:24  WinTime\ico00001.ico

     文件       2998  2008-07-16 23:04  WinTime\icon1.ico

     文件       2998  2008-07-15 22:15  WinTime\icon2.ico

     文件      19960  2008-07-16 23:03  WinTime\recourse.aps

     文件       1721  2008-07-15 22:24  WinTime\recourse.rc

     文件       3124  2008-07-16 23:35  WinTime\Release\recourse.res

     文件      41984  2008-07-18 07:54  WinTime\Release\vc60.idb

     文件      28672  2008-07-18 07:54  WinTime\Release\WinTime.exe

     文件       3285  2008-07-18 07:54  WinTime\Release\WinTime.obj

     文件        456  2008-07-16 23:04  WinTime\resource.h

     文件      19972  2008-07-16 23:08  WinTime\WinTime.aps

     文件       2085  2008-07-18 07:53  WinTime\WinTime.cpp

     文件       4061  2008-07-16 23:35  WinTime\WinTime.dsp

     文件        539  2008-07-15 19:09  WinTime\WinTime.dsw

     文件      41984  2008-07-27 12:24  WinTime\WinTime.ncb

     文件      53760  2008-07-27 12:24  WinTime\WinTime.opt

     文件       1132  2008-07-18 07:54  WinTime\WinTime.plg

     文件       1721  2008-07-16 23:04  WinTime\WinTime.rc

     目录          0  2008-07-18 17:52  WinTime\Debug

     目录          0  2008-07-18 17:52  WinTime\Release

............此处省略4个文件信息

评论

共有 条评论

相关资源