//Copyright (c) 1997-2000 Microsoft Corporation #include "pch.hxx" // pch #pragma hdrstop #include "resource.h" #include "CurSchme.h" DWORD g_dwSchemeSource; static LPCTSTR g_rgszCursorNames[] = { __TEXT("Arrow"), __TEXT("Help"), __TEXT("AppStarting"), __TEXT("Wait"), __TEXT("Crosshair"), __TEXT("IBeam"), __TEXT("NWPen"), __TEXT("No"), __TEXT("SizeNS"), __TEXT("SizeWE"), __TEXT("SizeNWSE"), __TEXT("SizeNESW"), __TEXT("SizeAll"), __TEXT("UpArrow"), __TEXT("Hand"), NULL // This is the default value }; #define CCURSORS (sizeof(g_rgszCursorNames) / sizeof(g_rgszCursorNames[0])) TCHAR g_szOrigCursors[CCURSORS][_MAX_PATH]; DWORD g_dwOrigSchemeSource = 0; const TCHAR g_szCursorRegPath[] = REGSTR_PATH_CURSORS; const TCHAR szSchemeSource[] = TEXT("Scheme Source"); TCHAR g_szSchemeNames[8][100]; // HACK - We have to make sure the scheme names are less than 100 characters typedef LANGID (WINAPI *pfnGetUserDefaultUILanguage)( void ); typedef LANGID (WINAPI *pfnGetSystemDefaultUILanguage)( void ); BOOL IsMUI_Enabled() { OSVERSIONINFO verinfo; LANGID rcLang; HMODULE hModule; pfnGetUserDefaultUILanguage gpfnGetUserDefaultUILanguage; pfnGetSystemDefaultUILanguage gpfnGetSystemDefaultUILanguage; static g_bPFNLoaded=FALSE; static g_bMUIStatus=FALSE; if(g_bPFNLoaded) return g_bMUIStatus; g_bPFNLoaded = TRUE; verinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx( &verinfo) ; if (verinfo.dwMajorVersion == 5) { hModule = GetModuleHandle(TEXT("kernel32.dll")); if (hModule) { gpfnGetSystemDefaultUILanguage = (pfnGetSystemDefaultUILanguage)GetProcAddress(hModule,"GetSystemDefaultUILanguage"); if (gpfnGetSystemDefaultUILanguage) { rcLang = (LANGID) gpfnGetSystemDefaultUILanguage(); if (rcLang == 0x409 ) { gpfnGetUserDefaultUILanguage = (pfnGetUserDefaultUILanguage)GetProcAddress(hModule,"GetUserDefaultUILanguage"); if (gpfnGetUserDefaultUILanguage) { if (rcLang != (LANGID)gpfnGetUserDefaultUILanguage() ) { g_bMUIStatus = TRUE; } } } } } } return g_bMUIStatus; } void LoadCursorSchemeNames() { static BOOL g_bSchemeNamesLoaded = FALSE; if(g_bSchemeNamesLoaded) return; g_bSchemeNamesLoaded = TRUE; if (!IsMUI_Enabled()) { LoadString(g_hInstDll, IDS_CURSOR_SCHEME_WINDOWS_STANDARD_LARGE , g_szSchemeNames[0], 100); LoadString(g_hInstDll, IDS_CURSOR_SCHEME_WINDOWS_STANDARD_EXTRALARGE, g_szSchemeNames[1], 100); LoadString(g_hInstDll, IDS_CURSOR_SCHEME_WINDOWS_BLACK , g_szSchemeNames[2], 100); LoadString(g_hInstDll, IDS_CURSOR_SCHEME_WINDOWS_BLACK_LARGE , g_szSchemeNames[3], 100); LoadString(g_hInstDll, IDS_CURSOR_SCHEME_WINDOWS_BLACK_EXTRALARGE , g_szSchemeNames[4], 100); LoadString(g_hInstDll, IDS_CURSOR_SCHEME_WINDOWS_INVERTED , g_szSchemeNames[5], 100); LoadString(g_hInstDll, IDS_CURSOR_SCHEME_WINDOWS_INVERTED_LARGE , g_szSchemeNames[6], 100); LoadString(g_hInstDll, IDS_CURSOR_SCHEME_WINDOWS_INVERTED_EXTRALARGE, g_szSchemeNames[7], 100); } else { lstrcpy(g_szSchemeNames[0],IDSENG_CURSOR_SCHEME_WINDOWS_STANDARD_LARGE); lstrcpy(g_szSchemeNames[1],IDSENG_CURSOR_SCHEME_WINDOWS_STANDARD_EXTRALARGE); lstrcpy(g_szSchemeNames[2],IDSENG_CURSOR_SCHEME_WINDOWS_BLACK); lstrcpy(g_szSchemeNames[3],IDSENG_CURSOR_SCHEME_WINDOWS_BLACK_LARGE); lstrcpy(g_szSchemeNames[4],IDSENG_CURSOR_SCHEME_WINDOWS_BLACK_EXTRALARGE); lstrcpy(g_szSchemeNames[5],IDSENG_CURSOR_SCHEME_WINDOWS_INVERTED); lstrcpy(g_szSchemeNames[6],IDSENG_CURSOR_SCHEME_WINDOWS_INVERTED_LARGE); lstrcpy(g_szSchemeNames[7],IDSENG_CURSOR_SCHEME_WINDOWS_INVERTED_EXTRALARGE); } // Load the current cursor settings HKEY hkCursors; if (ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, g_szCursorRegPath, &hkCursors )) { for(int i=0;i