-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHotCorners.cpp
71 lines (67 loc) · 2.21 KB
/
HotCorners.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//==========================================================================
//
// File: HotCorners.cpp
//
//==========================================================================
#include <windows.h>
//******************************************************************************************
// CheckHots: this routine checks for Hot Corner services.
// It first tries with SAGE.DLL, which comes with Windows Plus!
// Failint this it tries with ScrHots, a third-party hot-corner
// service program written by the author that is freely
// distributable and works with NT and '95.
// It's not actually used in the saver, but code is included here
// just to be useful.
BOOL
CheckHots()
{
typedef BOOL (WINAPI *SYSTEMAGENTDETECT)();
HINSTANCE sagedll = LoadLibrary("Sage.dll");
if (sagedll != NULL)
{
SYSTEMAGENTDETECT detectproc =
(SYSTEMAGENTDETECT)GetProcAddress(sagedll, "System_Agent_Detect");
BOOL res = FALSE;
if (detectproc != NULL) res = detectproc();
FreeLibrary(sagedll);
if (res) return TRUE;
}
HINSTANCE hotsdll = LoadLibrary("ScrHots.dll");
if (hotsdll != NULL)
{
SYSTEMAGENTDETECT detectproc =
(SYSTEMAGENTDETECT)GetProcAddress(hotsdll, "System_Agent_Detect");
BOOL res = FALSE;
if (detectproc != NULL) res = detectproc();
FreeLibrary(hotsdll);
if (res) return TRUE;
}
return FALSE;
}
//******************************************************************************************
// NotifyHots: if you make any changes to the hot corner
// information in the registry, you must call NotifyHots
// to inform the hot corner services of your change.
// It's not actually used in the saver, but code is included here
// just to be useful.
void __fastcall
NotifyHots()
{
typedef VOID (WINAPI *SCREENSAVERCHANGED)();
HINSTANCE sagedll = LoadLibrary("Sage.DLL");
if (sagedll != NULL)
{
SCREENSAVERCHANGED changedproc =
(SCREENSAVERCHANGED)GetProcAddress(sagedll, "Screen_Saver_Changed");
if (changedproc != NULL) changedproc();
FreeLibrary(sagedll);
}
HINSTANCE hotsdll = LoadLibrary("ScrHots.dll");
if (hotsdll != NULL)
{
SCREENSAVERCHANGED changedproc =
(SCREENSAVERCHANGED)GetProcAddress(hotsdll, "Screen_Saver_Changed");
if (changedproc != NULL) changedproc();
FreeLibrary(hotsdll);
}
}