Added TaskManager app

This commit is contained in:
Anonymous
2014-01-16 20:06:39 -07:00
parent 39e541c767
commit 2bcd8a262c
46 changed files with 4822 additions and 0 deletions
@@ -0,0 +1,33 @@
#include "FirstTaskManager.h"
namespace EnvironmentVariable
{
bool addToEnvironmentVariable(const char* key, const char* value)
{
bool retval = false;
char oldValue[256];
DWORD tmp = GetEnvironmentVariable(key, oldValue, sizeof(oldValue));
if (tmp != 0)
{
std::string s(oldValue);
s += ";";
s += value;
//Bad things happen if the first character happens to be ; (ie from an empty environment string)
const char* newValue = s.c_str();
if (newValue[0] == ';')
++newValue;
retval = (SetEnvironmentVariable(key, newValue) != 0);
}
else
{
retval = (SetEnvironmentVariable(key, value) != 0);
}
return retval;
}
bool setEnvironmentVariable(const char* key, const char* value)
{
return (SetEnvironmentVariable(key, value) != 0);
}
};