CSDN博客

img Lu_ming

2008 September 10th Wednesday (九月 十日 水曜日)

发表于2008/10/1 15:15:00  319人阅读

   Today is Teacher Day!!!  My testing report about accumulating thread will be changed to unit testing.  So, today I have to test
all kinds of comparing methods.  The unit testing report will be written in furture.

  I tried to learn a simple screen saver.

//resource.h

//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by my_screensaver.rc
//
//#include "my_screensaver.h"

#define DLG_SCRNSAVECONFIGURE           101

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        102
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1000
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif


// my_screensaver.cpp : Defines the entry point for the application.
//

#include "stdafx.h"

#pragma comment(lib, "scrnsave.lib")
#include "resource.h"
#include <scrnsave.h>

LRESULT CALLBACK ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message){
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hDC = BeginPaint(hWnd, &ps);
SetBkMode(hDC, TRANSPARENT);
SetTextColor(hDC, RGB(0x33, 0xcc, 0));
TextOut(hDC, 150, 150, "Hello Screen Saver!!", 20);
EndPaint(hWnd, &ps);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefScreenSaverProc(hWnd, message, wParam, lParam);
}

return 0;
}

BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message){
case WM_COMMAND:
if (LOWORD(wParam) == IDOK){
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
else{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}

BOOL WINAPI RegisterDialogClasses(HANDLE hInst)
{
return TRUE;
}
阅读全文
0 0

相关文章推荐

img
取 消
img