Пытаюсь менять темы программно. А также пытаюсь получать описание определенной темы, но не выходит ни то ни другое
| Код | typedef int (__stdcall *SetSystemVisualStyle)(LPCWSTR a, LPCWSTR b, LPCWSTR c, int m); typedef HRESULT (__stdcall *GetCurrentThemeName)(LPWSTR, int, LPWSTR, int, LPWSTR, int);
void GetTheme() { HMODULE hmUxtheme = LoadLibrary("C:\\Windows\\System32\\uxtheme.dll"); if(hmUxtheme == NULL) std::cout << L"Error loading module" << std::endl;
GetCurrentThemeName GetCurrentThemeNamePtr = NULL; GetCurrentThemeNamePtr = (GetCurrentThemeName)GetProcAddress(hmUxtheme, MAKEINTRESOURCE(94)); if(!GetCurrentThemeNamePtr) { std::cout << L"Cannot find GetCurrentThemeName in uxtheme" << std::endl; } else { WCHAR fileName[255] = {'\0'}; WCHAR colorScheme[255] = {'\0'}; WCHAR sizeName[255] = {'\0'}; HRESULT hret = GetCurrentThemeNamePtr(fileName,255,colorScheme,255,sizeName,255); CString res; res.Format("Return: %d, Name: %S, Color: %S, Style: %S", hret, fileName, colorScheme, sizeName); std::cout << res << std::endl; } } void SetVisualStyle() {
HMODULE hmUxtheme = LoadLibrary("C:\\Windows\\System32\\uxtheme.dll"); if(hmUxtheme == NULL) std::cout << L"Error loading module" << std::endl;
SetSystemVisualStyle SetSystemVisualStylePtr = (SetSystemVisualStyle)GetProcAddress(hmUxtheme, MAKEINTRESOURCE(65)); if(!SetSystemVisualStylePtr) std::cout << L"Cannot find SetSystemVisualStyle in uxtheme" << std::endl; else (SetSystemVisualStylePtr)(L"C:\\WINDOWS\\Resources\\Themes\\Luna\\luna.msstyles", L"Metallic", L"NormalSize", 0); FreeLibrary(hmUxtheme); }
int _tmain(int argc, _TCHAR* argv[]) { SetVisualStyle(); GetTheme(); return 0; }
|
GetProcAddress возвращает не NULL ord`ы для MAKEINTRESOURCE правильные (в IDA pro проверял). В чем может быть дело
|