X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fregistry.cpp;h=576207acb3bbb5e6b500cfeea2718c1e39b75e37;hb=72ee24a9cf364cfbf32b878172eea5f6ad2676c3;hp=cbf3862727ff7f93fb487fe51aa2b0ec109a6403;hpb=6d13a5166688e470590692eb91c3915ab332fe36;p=ttedit diff --git a/src/registry.cpp b/src/registry.cpp index cbf3862..576207a 100755 --- a/src/registry.cpp +++ b/src/registry.cpp @@ -1,94 +1,94 @@ -// -// REGISTRY.CPP - Win32 support file -// by James L. Hammons -// (C) 2002 Underground Software -// -// JLH = James Hammons -// -// Who When What -// --- ---------- ------------------------------------------------------------ -// JLH 05/16/2002 Created this file -// JLH 12/10/2002 Updated InitINIFile to take a parameter so that you can open -// an .INI file that doesn't belong to the current module -// -// STILL TO BE DONE: -// -// - Convert to wxWidgets... -// - -#warning This file not yet converted to wxWidgets!!! - -#if 0 -#include -#include "registry.h" - -// Local data - -static char INIPath[MAX_PATH]; -static char str[4096]; - -// -// Initialize the application .INI file -// Returns TRUE if succesful, FALSE otherwise... -// -void InitINIFile(char * path/*= NULL*/) -{ - if (!GetModuleFileName(NULL, INIPath, MAX_PATH)) - return; - - if (path == NULL) - { - int len = lstrlen(INIPath); - lstrcpy(INIPath + len - 4, ".ini"); - } - else - { - for(int i=lstrlen(INIPath); i>=0; i--) - { - if (INIPath[i] == '\\') - { - lstrcpy(INIPath + i + 1, path); - break; - } - } - } -} - -// -// Write an int value to our .INI file -// -void SetINIInt(char * section, char * entry, int32 value) -{ - const char fmtStr[] = "%d"; - char strVal[20]; - - wsprintf(strVal, fmtStr, value); - WritePrivateProfileString(section, entry, strVal, INIPath); -} - -// -// Write a string value to our .INI file -// -void SetINIString(char * section, char * entry, char * value) -{ - WritePrivateProfileString(section, entry, value, INIPath); -} - -// -// Get an int value from our .INI file -// -int32 GetINIInt(char * section, char * entry, int32 _default) -{ - return GetPrivateProfileInt(section, entry, _default, INIPath); -} - -// -// Get a string value from our .INI file -// -const char * GetINIString(char * section, char * entry, char * _default) -{ - GetPrivateProfileString(section, entry, _default, str, 4096, INIPath); - - return str; -} -#endif +// +// REGISTRY.CPP - Win32 support file +// by James L. Hammons +// (C) 2002 Underground Software +// +// JLH = James Hammons +// +// Who When What +// --- ---------- ------------------------------------------------------------ +// JLH 05/16/2002 Created this file +// JLH 12/10/2002 Updated InitINIFile to take a parameter so that you can open +// an .INI file that doesn't belong to the current module +// +// STILL TO BE DONE: +// +// - Convert to wxWidgets... +// + +#warning This file not yet converted to wxWidgets!!! + +#if 0 +#include +#include "registry.h" + +// Local data + +static char INIPath[MAX_PATH]; +static char str[4096]; + +// +// Initialize the application .INI file +// Returns TRUE if succesful, FALSE otherwise... +// +void InitINIFile(char * path/*= NULL*/) +{ + if (!GetModuleFileName(NULL, INIPath, MAX_PATH)) + return; + + if (path == NULL) + { + int len = lstrlen(INIPath); + lstrcpy(INIPath + len - 4, ".ini"); + } + else + { + for(int i=lstrlen(INIPath); i>=0; i--) + { + if (INIPath[i] == '\\') + { + lstrcpy(INIPath + i + 1, path); + break; + } + } + } +} + +// +// Write an int value to our .INI file +// +void SetINIInt(char * section, char * entry, int32 value) +{ + const char fmtStr[] = "%d"; + char strVal[20]; + + wsprintf(strVal, fmtStr, value); + WritePrivateProfileString(section, entry, strVal, INIPath); +} + +// +// Write a string value to our .INI file +// +void SetINIString(char * section, char * entry, char * value) +{ + WritePrivateProfileString(section, entry, value, INIPath); +} + +// +// Get an int value from our .INI file +// +int32 GetINIInt(char * section, char * entry, int32 _default) +{ + return GetPrivateProfileInt(section, entry, _default, INIPath); +} + +// +// Get a string value from our .INI file +// +const char * GetINIString(char * section, char * entry, char * _default) +{ + GetPrivateProfileString(section, entry, _default, str, 4096, INIPath); + + return str; +} +#endif