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.

58 lines
989 B

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. HideCursor.cpp
  5. Abstract:
  6. ShowCursor will display the cursor if the count is >= 0, this shim will
  7. force ShowCursor to act as a toggle rather than a count.
  8. In other words it forces the count to be 0 or -1.
  9. History:
  10. 05/25/2001 robkenny Created
  11. --*/
  12. #include "precomp.h"
  13. IMPLEMENT_SHIM_BEGIN(HideCursor)
  14. #include "ShimHookMacro.h"
  15. APIHOOK_ENUM_BEGIN
  16. APIHOOK_ENUM_ENTRY(ShowCursor)
  17. APIHOOK_ENUM_END
  18. int
  19. APIHOOK(ShowCursor)(
  20. BOOL bShow // cursor visibility
  21. )
  22. {
  23. int nShowCount = ShowCursor(bShow);
  24. while (nShowCount > 0)
  25. {
  26. // Hide the cursor until the count reaches 0
  27. nShowCount = ShowCursor(FALSE);
  28. }
  29. while (nShowCount < -1)
  30. {
  31. // Show the cursor until the count reaches -1
  32. nShowCount = ShowCursor(TRUE);
  33. }
  34. return nShowCount;
  35. }
  36. HOOK_BEGIN
  37. APIHOOK_ENTRY(USER32.DLL, ShowCursor)
  38. HOOK_END
  39. IMPLEMENT_SHIM_END