-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
213 changed files
with
12,239 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0
7/CfgFuncs.cpp → App/CfgFuncs.cpp
100644 → 100755
File renamed without changes.
0
7/CfgFuncs.h → App/CfgFuncs.h
100644 → 100755
File renamed without changes.
File renamed without changes.
0
7/Help/Checking for Updates.htm → App/Help/Checking for Updates.htm
100644 → 100755
File renamed without changes.
0
7/Help/Contact Information.htm → App/Help/Contact Information.htm
100644 → 100755
File renamed without changes.
0
7/Help/FAQ.htm → App/Help/FAQ.htm
100644 → 100755
File renamed without changes.
0
7/Help/Index.hhk → App/Help/Index.hhk
100644 → 100755
File renamed without changes.
0
7/Help/Introduction.htm → App/Help/Introduction.htm
100644 → 100755
File renamed without changes.
0
7/Help/Known Issues.htm → App/Help/Known Issues.htm
100644 → 100755
File renamed without changes.
0
7/Help/Lock Method.htm → App/Help/Lock Method.htm
100644 → 100755
File renamed without changes.
0
7/Help/Options.htm → App/Help/Options.htm
100644 → 100755
File renamed without changes.
0
7/Help/Readme.htm → App/Help/Readme.htm
100644 → 100755
File renamed without changes.
0
7/Help/Requirements.htm → App/Help/Requirements.htm
100644 → 100755
File renamed without changes.
File renamed without changes.
0
7/Help/SimplyTransparent.hhp → App/Help/SimplyTransparent.hhp
100644 → 100755
File renamed without changes.
0
7/Help/Table of Contents.hhc → App/Help/Table of Contents.hhc
100644 → 100755
File renamed without changes.
0
7/Help/The Menu.htm → App/Help/The Menu.htm
100644 → 100755
File renamed without changes.
0
7/Help/Troubleshooting.htm → App/Help/Troubleshooting.htm
100644 → 100755
File renamed without changes.
0
7/Help/Version History.htm → App/Help/Version History.htm
100644 → 100755
File renamed without changes.
0
7/Help/Welcome.htm → App/Help/Welcome.htm
100644 → 100755
File renamed without changes.
0
7/Help/backdrop.jpg → App/Help/backdrop.jpg
100644 → 100755
File renamed without changes
0
7/Options.cpp → App/Options.cpp
100644 → 100755
File renamed without changes.
0
7/Options.h → App/Options.h
100644 → 100755
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
/////////////////////////////////////////////////////////////////////////////// | ||
//// Configuration Functions | ||
// | ||
#include "stdafx.h" | ||
#include "SimplyTransparent.h" | ||
#include "CfgFuncs.h" | ||
|
||
|
||
|
||
COLORREF rgb_from_text( string txt_rgb ) | ||
{ | ||
|
||
int R,G,B; | ||
char color[15]; | ||
char * buf; | ||
|
||
txt_rgb.copy( color, 15 ); | ||
|
||
buf = strtok( color, "," ); | ||
R = atoi( buf ); | ||
|
||
buf = strtok( 0, "," ); | ||
G = atoi( buf ); | ||
|
||
buf = strtok( 0, "," ); | ||
B = atoi( buf ); | ||
|
||
return RGB(R,G,B); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
string rgb_to_text( COLORREF c )//char[15] | ||
{ | ||
char color_rgb[15]; | ||
sprintf( color_rgb, "%d,%d,%d", GetRValue(c), GetGValue(c), GetBValue(c) ); | ||
|
||
string color = color_rgb; | ||
|
||
return color; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
DWORD ReadIntSetting( string section, string lable, DWORD def ) | ||
{ | ||
DWORD x = 0; | ||
|
||
try{ | ||
|
||
DWORD *n = NULL; | ||
bool bAlloced = false; | ||
|
||
n = (DWORD *)ReadSetting( (char *)section.c_str(), (char *)lable.c_str(), &def, &x, bAlloced ); | ||
|
||
x = *n; | ||
|
||
|
||
} | ||
catch(...){ | ||
__ErrorMessage( "ReadIntSetting( )" ); | ||
} | ||
|
||
return x; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
void WriteIntSetting( string section, string lable, int data ) | ||
{ | ||
WriteSetting( (char *)section.c_str(), (char *)lable.c_str(), &data ); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
DWORD ReadRGBSetting( string section, string lable, string def ) | ||
{ | ||
COLORREF x; | ||
|
||
try{ | ||
|
||
char *n = NULL; | ||
bool bAlloced = false; | ||
|
||
n = ReadSetting( (char *)section.c_str(), (char *)lable.c_str(), (char *)def.c_str(), n, bAlloced ); | ||
|
||
|
||
x = rgb_from_text( n ); | ||
|
||
|
||
if(bAlloced) | ||
delete n; | ||
|
||
} | ||
catch(...){ | ||
__ErrorMessage( "ReadRGBSetting( )" ); | ||
} | ||
|
||
return x; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
void WriteRGBSetting( string section, string lable, COLORREF data ) | ||
{ | ||
try{ | ||
string rgb = rgb_to_text( data ); | ||
|
||
WriteSetting( (char *)section.c_str(), (char *)lable.c_str(), rgb.c_str( ) ); | ||
|
||
} | ||
catch(...){ | ||
__ErrorMessage( "ReadRGBSetting( )" ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
/////////////////////////////////////////////////////////////////////////////// | ||
//// Configuration Functions header file (CfgFuncs.h) | ||
// | ||
|
||
#ifndef ____CFG_FUNCS_H___ | ||
#define ____CFG_FUNCS_H___ | ||
|
||
#include "resource.h" | ||
#include <winreg.h> | ||
|
||
COLORREF rgb_from_text( string txt_rgb ); | ||
string rgb_to_text( COLORREF c ); | ||
|
||
DWORD ReadIntSetting( string section, string lable, DWORD def ); | ||
void WriteIntSetting( string section, string lable, int data ); | ||
|
||
DWORD ReadRGBSetting( string section, string lable, string def ); | ||
void WriteRGBSetting( string section, string lable, COLORREF data ); | ||
|
||
template <class T> | ||
inline int WriteSetting( char section[], char lable[], T *data ) | ||
{ | ||
int ret = 1; | ||
|
||
try{ | ||
|
||
const unsigned int string_size = 50; | ||
|
||
DWORD disposition; | ||
LONG res = 0; | ||
HKEY softkey = NULL, key = NULL; | ||
char subkey[MAX_PATH]; | ||
char appname[string_size]; | ||
char author[string_size]; | ||
|
||
LoadString( GetMyInstanceHandle( ), IDS_APP_TITLE, | ||
appname, string_size ); | ||
|
||
LoadString( GetMyInstanceHandle( ), IDS_REGISTRY_KEY, | ||
author, string_size ); | ||
|
||
sprintf( subkey, "%s\\%s\\%s", author, appname, section ); | ||
|
||
res = RegOpenKeyEx( HKEY_CURRENT_USER, "software", 0, KEY_WRITE, | ||
&softkey ); | ||
if( ERROR_SUCCESS == res ) | ||
{ | ||
res = RegCreateKeyEx( softkey, subkey, 0, "key", | ||
REG_OPTION_NON_VOLATILE, KEY_WRITE, 0, &key, &disposition ); | ||
if( ERROR_SUCCESS == res ) | ||
{ | ||
res = RegSetValueEx(key, lable, 0, | ||
( sizeof( *data ) == sizeof( char ) ) ? REG_SZ : REG_DWORD, | ||
(BYTE*)data, ( sizeof( *data ) == sizeof( char ) ) ? strlen( (const char *) data ) : sizeof( data ) ); | ||
if( ERROR_SUCCESS == res ) | ||
{ | ||
ret = 0; | ||
} | ||
} | ||
} | ||
|
||
RegCloseKey( softkey ); | ||
RegCloseKey( key ); | ||
|
||
}catch(...){ | ||
|
||
__ErrorMessage( "WriteSetting( )" ); | ||
|
||
} | ||
|
||
return ret; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
template <class T> | ||
inline T * ReadSetting( char section[], char lable[], T *def, T *data, bool &alloced ) | ||
{ | ||
LONG res = 0; | ||
|
||
try { | ||
|
||
const unsigned int string_size = 50; | ||
|
||
DWORD disposition, size, type = ( sizeof( *def ) == sizeof( char ) ) ? REG_SZ : REG_DWORD; | ||
|
||
HKEY softkey = NULL, key = NULL; | ||
char subkey[MAX_PATH]; | ||
char appname[string_size]; | ||
char author[string_size]; | ||
|
||
LoadString( GetMyInstanceHandle( ), IDS_APP_TITLE, | ||
appname, string_size ); | ||
|
||
LoadString( GetMyInstanceHandle( ), IDS_REGISTRY_KEY, | ||
author, string_size ); | ||
|
||
sprintf( subkey, "%s\\%s\\%s", author, appname, section ); | ||
|
||
res = RegOpenKeyEx( HKEY_CURRENT_USER, "software", 0, KEY_WRITE, | ||
&softkey ); | ||
if( ERROR_SUCCESS == res ) | ||
{ | ||
res = RegCreateKeyEx( softkey, subkey, 0, "key", | ||
REG_OPTION_NON_VOLATILE, KEY_QUERY_VALUE, 0, &key, &disposition ); | ||
if( ERROR_SUCCESS == res ) | ||
{ | ||
res = RegQueryValueEx(key, lable, 0, &type, 0, &size ); | ||
if( ERROR_SUCCESS == res ) | ||
{ | ||
if( type == REG_SZ ) | ||
{ | ||
alloced = true; | ||
data = new T[size/sizeof(T)]; | ||
} | ||
|
||
res = RegQueryValueEx(key, lable, 0, &type, (BYTE*)data, | ||
&size ); | ||
|
||
res = ( ERROR_SUCCESS == res ) ? 1 : 0; | ||
|
||
if(res != 1) | ||
{ | ||
if(type == REG_SZ) | ||
delete data; | ||
|
||
data = def; | ||
} | ||
} | ||
else data = def; | ||
} | ||
else data = def; | ||
} | ||
else data = def; | ||
|
||
RegCloseKey( softkey ); | ||
RegCloseKey( key ); | ||
|
||
}catch(...){ | ||
|
||
__ErrorMessage( "T * ReadSetting( )" ); | ||
|
||
} | ||
|
||
return (res == 1) ? data : def; | ||
} | ||
|
||
#endif //____CFG_FUNCS_H___ |
Oops, something went wrong.