mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-30 04:53:04 +00:00
better registry function
This commit is contained in:
@@ -11,13 +11,23 @@ typedef struct userdata {
|
|||||||
static void detect_darktheme(MwLL handle){
|
static void detect_darktheme(MwLL handle){
|
||||||
DWORD dw;
|
DWORD dw;
|
||||||
DWORD sz = sizeof(dw);
|
DWORD sz = sizeof(dw);
|
||||||
|
int err, t;
|
||||||
|
HKEY hkey;
|
||||||
|
DWORD type;
|
||||||
|
|
||||||
if(RegGetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme", RRF_RT_REG_DWORD, NULL, &dw, &sz) == ERROR_SUCCESS){
|
err = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", 0, KEY_QUERY_VALUE, &hkey);
|
||||||
int t = dw ? 0 : 1;
|
if(err != ERROR_SUCCESS) return;
|
||||||
|
|
||||||
|
err = RegQueryValueEx(hkey, "AppsUseLightTheme", NULL, &type, (PBYTE)&dw, &sz);
|
||||||
|
if(err != ERROR_SUCCESS || type != REG_DWORD){
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
t = dw ? 0 : 1;
|
||||||
|
|
||||||
MwLLDispatch(handle, dark_theme, &t);
|
MwLLDispatch(handle, dark_theme, &t);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
||||||
userdata_t* u = (userdata_t*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
userdata_t* u = (userdata_t*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||||
|
|||||||
Reference in New Issue
Block a user