Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.2 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. 3DFrogFrenzy.cpp
  5. Abstract:
  6. Workaround for a USER bug (or by design behaviour) where if you call
  7. SetCursor(NULL) and the cursor is over somebody elses window, the
  8. cursor stays visible.
  9. We don't normally see this because most apps that want the cursor to
  10. be invisible are full-screen: so the cursor is always over their window.
  11. Notes:
  12. This is an app-specific shim.
  13. History:
  14. 01/20/2000 linstev Created
  15. --*/
  16. #include "precomp.h"
  17. IMPLEMENT_SHIM_BEGIN(3DFrogFrenzy)
  18. #include "ShimHookMacro.h"
  19. APIHOOK_ENUM_BEGIN
  20. APIHOOK_ENUM_ENTRY(SetCursor)
  21. APIHOOK_ENUM_END
  22. /*++
  23. Move the cursor to the middle of their window, so that SetCursor works.
  24. --*/
  25. HCURSOR
  26. APIHOOK(SetCursor)(
  27. HCURSOR hCursor
  28. )
  29. {
  30. HWND hWndFrog = FindWindowW(L"3DFrog", L"3D Frog Frenzy");
  31. BOOL bRet = FALSE;
  32. if (hWndFrog) {
  33. RECT r;
  34. if (GetWindowRect(hWndFrog, &r)) {
  35. SetCursorPos(r.left + (r.right - r.left) / 2, r.top + (r.bottom - r.top) / 2);
  36. }
  37. }
  38. return ORIGINAL_API(SetCursor)(hCursor);
  39. }
  40. /*++
  41. Register hooked functions
  42. --*/
  43. HOOK_BEGIN
  44. APIHOOK_ENTRY(USER32.DLL, SetCursor)
  45. HOOK_END
  46. IMPLEMENT_SHIM_END