View Full Version : system calls?
yathosho
02-28-2005, 09:59 AM
i'm writing an application, which disables some of windows xp's candy-look. i figured that changing a windows-theme or switching to classic start-menu through the registry won't do any change until you reboot your machine.
so i guess one has to do that using system calls. msdn isn't of big help if you do more specific searches (i.e. system call to change windows-theme) and i could not get any results with google. is anyone here aware of a good documentation on this? is there a software (like registrymonitor for registry manipulations) which give me more insight into system calls?
all help appreciated, thanks in advance!
Dr. Evil
02-28-2005, 10:53 AM
If you're changing the registry just use the API registry calls, documented here (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/registry.asp). This little code snippet might make all that about writing keys bit clearer, if that helps at all:
#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "Advapi32.lib")
//Returns 1 if cannot open key, 2 if cannot write key and 0 if successful
int AddRegistryStringValue(HKEY baskey, LPSTR subkey, LPSTR name, LPSTR value)
{
HKEY key;
DWORD dis;
int ret;
/*The disposition DWORD can be either REG_CREATED_NEW_KEY or REG_OPENED_EXISTING_KEY.
The former means it didn't exist and was created, the latter means it did exist and was opened*/
if(RegCreateKeyEx(basekey, subkey,
0, NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE,
NULL, &key, &dis) == ERROR_SUCCESS)
{
if(RegSetValueEx(key, name,
0, REG_EXPAND_SZ, //REG_EXPAND_SZ specifies it is a string type to store such things as paths
(LPBYTE)value,
(DWORD)lstrlen(value)+1) == ERROR_SUCCESS) ret = 0;
else ret = 2;
RegCloseKey(key);
}
else ret = 1;
return ret;
}
int main(int argc, char *argv[])
{
if(AddRegistryStringValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
"Nothing", argv[0]) == 0) printf("Write successful");
else printf("Write failure");
return 0;
}
It basically just adds it self to the start on logon list of applications.
yathosho
02-28-2005, 12:08 PM
if i understand you correctly, this only changes the settings in the registry without applying them? if so, that's my problem.. i want to avoid a reboot for simple changes like theme-changing. i was also wondering if i need system calls for each change or if there's a general call (i.e. to reload visual settings of windows.. theme, screensaver, etc).
Dr. Evil
02-28-2005, 01:48 PM
I don't know if this is what you need exactly, but here's (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/themesinstaller.asp) an article on theme files and executing them.
yathosho
03-07-2005, 07:03 PM
maybe theme files were a bad example, let's say i want to switch to classic startmenu
yathosho
04-18-2005, 11:58 AM
please ;)
Dr. Evil
04-18-2005, 07:06 PM
You could take a look at the related functions to IsThemeActive() (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/functions/isthemeactive.asp), there might be something useful.
yathosho
04-19-2005, 12:53 AM
it is, thanks a lot!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.