ReactOS  0.4.14-dev-52-g6116262
circles.c File Reference
#include <windows.h>
#include <scrnsave.h>
#include <tchar.h>
#include "resource.h"
Include dependency graph for circles.c:

Go to the source code of this file.

Macros

#define RANDOM_COLOR   (rand () % 256)
 
#define APPNAME   _T("Circles")
 
#define APP_TIMER   1
 
#define APP_TIMER_INTERVAL   100
 
#define MAX_CIRCLES   50
 

Functions

LRESULT WINAPI ScreenSaverProc (HWND hwnd, UINT iMsg, WPARAM wparam, LPARAM lparam)
 
BOOL WINAPI ScreenSaverConfigureDialog (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI RegisterDialogClasses (HANDLE hInst)
 

Variables

int circlesCount
 
int width
 
int x
 
int y
 

Macro Definition Documentation

◆ APP_TIMER

#define APP_TIMER   1

Definition at line 27 of file circles.c.

◆ APP_TIMER_INTERVAL

#define APP_TIMER_INTERVAL   100

Definition at line 28 of file circles.c.

◆ APPNAME

#define APPNAME   _T("Circles")

Definition at line 26 of file circles.c.

◆ MAX_CIRCLES

#define MAX_CIRCLES   50

Definition at line 29 of file circles.c.

◆ RANDOM_COLOR

#define RANDOM_COLOR   (rand () % 256)

Definition at line 24 of file circles.c.

Function Documentation

◆ RegisterDialogClasses()

BOOL WINAPI RegisterDialogClasses ( HANDLE  hInst)

Definition at line 99 of file circles.c.

100 {
101  TCHAR szMessage[256];
102  TCHAR szTitle[25];
103 
104  LoadString(hInst, IDS_TEXT, szMessage, sizeof(szMessage) / sizeof(TCHAR));
105  LoadString(hInst, IDS_DESCRIPTION, szTitle, sizeof(szTitle) / sizeof(TCHAR));
106 
108 
109  return FALSE;
110 }
#define IDS_DESCRIPTION
Definition: resource.h:92
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define MessageBox
Definition: winuser.h:5723
HINSTANCE hInst
Definition: dxdiag.c:13
#define MB_OK
Definition: winuser.h:784
#define IDS_TEXT
Definition: resource.h:3
#define LoadString
Definition: winuser.h:5720

◆ ScreenSaverConfigureDialog()

BOOL WINAPI ScreenSaverConfigureDialog ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 92 of file circles.c.

93 {
94  return FALSE;
95 }

◆ ScreenSaverProc()

LRESULT WINAPI ScreenSaverProc ( HWND  hwnd,
UINT  iMsg,
WPARAM  wparam,
LPARAM  lparam 
)

Definition at line 34 of file circles.c.

35 {
36  HDC hdc;
37  RECT rect;
38  HBRUSH hbrush, hbrushOld;
39 
40  switch (iMsg)
41  {
42  case WM_CREATE:
44  break;
45 
46  case WM_DESTROY:
48  PostQuitMessage (0);
49  return 0;
50 
51  case WM_TIMER:
52  hdc = GetDC (hwnd);
55  hbrushOld = SelectObject (hdc, hbrush);
56 
57  x = rand () % rect.right;
58  y = rand () % rect.bottom;
59 
60  /* the circle will be 10% of total screen */
61  width = rect.right / 10;
62  if (rect.bottom / 10 < width)
63  width = rect.bottom / 10;
64 
65  /* Draw circle on screen */
66  Ellipse (
67  hdc,
68  x,
69  y,
70  x + width,
71  y + width);
72 
73  //Track the number of painted circles on scren
74  circlesCount++;
76  {
78  circlesCount = 0;
79  }
80 
81  SelectObject (hdc, hbrushOld);
83  ReleaseDC (hwnd, hdc);
84 
85  return 0;
86  }
87 
88  return DefScreenSaverProc (hwnd, iMsg, wparam, lparam);
89 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
static HBRUSH hbrush
HDC WINAPI GetDC(_In_opt_ HWND)
#define APP_TIMER
Definition: circles.c:27
static HDC
Definition: imagelist.c:92
#define RANDOM_COLOR
Definition: circles.c:24
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define MAX_CIRCLES
Definition: circles.c:29
int circlesCount
Definition: circles.c:31
& rect
Definition: startmenu.cpp:1413
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
#define APP_TIMER_INTERVAL
Definition: circles.c:28
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_TIMER
Definition: winuser.h:1724
#define RGB(r, g, b)
Definition: wingdi.h:2935
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
HDC hdc
Definition: main.c:9
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI Ellipse(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define WM_CREATE
Definition: winuser.h:1590
LRESULT WINAPI DefScreenSaverProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: scrnsave.c:95
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
static UINT WPARAM wparam
Definition: combo.c:716

Variable Documentation

◆ circlesCount

int circlesCount

Definition at line 31 of file circles.c.

Referenced by ScreenSaverProc().

◆ width

Definition at line 32 of file circles.c.

◆ x

int x

Definition at line 32 of file circles.c.

◆ y

int y

Definition at line 32 of file circles.c.