Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ///////////////////////////////////////
- MouseShadowFix by vebero v1.0
- ///////////////////////////////////////
- */
- #define WIN32_LEAN_AND_MEAN
- #include <Windows.h>
- #pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
- typedef __int32 int32;
- typedef unsigned __int32 uint32;
- #define MSGBOX_ERROR MB_ICONERROR | MB_OK
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
- {
- int32 nResult;
- HKEY hKey = nullptr;
- nResult = RegOpenKeyEx(HKEY_CURRENT_USER,
- L"Control Panel\\Desktop",
- 0,
- KEY_NOTIFY,
- &hKey);
- if(nResult != ERROR_SUCCESS)
- MessageBox(nullptr, L"RegOpenKeyEx failed.", L"MouseShadowFix", MSGBOX_ERROR);
- HANDLE hEvent = CreateEvent(nullptr, false, false, nullptr);
- if(!hEvent)
- MessageBox(nullptr, L"CreateEvent failed.", L"MouseShadowFix", MSGBOX_ERROR);
- while(true)
- {
- uint32 unFilter = REG_NOTIFY_CHANGE_LAST_SET;
- nResult = RegNotifyChangeKeyValue(hKey,
- false,
- unFilter,
- hEvent,
- true);
- if(nResult != ERROR_SUCCESS)
- MessageBox(nullptr, L"RegNotifyChangeKeyValue failed.", L"MouseShadowFix", MSGBOX_ERROR);
- if(WaitForSingleObject(hEvent, INFINITE) == WAIT_OBJECT_0)
- {
- bool bShadowEnabled;
- BOOL bResult = SystemParametersInfo(SPI_GETCURSORSHADOW,
- 0,
- &bShadowEnabled,
- 0);
- if(!bResult)
- MessageBox(nullptr, L"SystemParametersInfo (GET) failed.", L"MouseShadowFix", MSGBOX_ERROR);
- if(!bShadowEnabled)
- {
- bool bCursorShadow = true;
- uint32 unChangeAction = SPIF_UPDATEINIFILE | SPIF_SENDCHANGE;
- BOOL bResult = SystemParametersInfo(SPI_SETCURSORSHADOW,
- 0,
- &bCursorShadow,
- unChangeAction);
- if(!bResult)
- MessageBox(nullptr, L"SystemParametersInfo (SET) failed.", L"MouseShadowFix", MSGBOX_ERROR);
- }
- }
- }
- CloseHandle(hEvent);
- RegCloseKey(hKey);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement