Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7925899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:29:38+00:00 2026-06-03T18:29:38+00:00

BACKGROUND: I’m trying to create a mouse hiding application that hides the user’s mouse

  • 0

BACKGROUND:

  • I’m trying to create a “mouse hiding” application that hides the user’s mouse from the screen after a set amount of time.
  • I’ve tried many things, and using SetCursor only hides the mouse from the current application, mine must be able to sit in the tray (for example) and still function.
  • I think I’ve found a solution with SetSystemCursor except for one problem.

MY PROBLEM:

  • I need to be able to capture any kind of mouse cursor, and replace the exact same kind of mouse cursor.
  • When replacing the mouse, I need to provide the id of the type of mouse I’d like to replace with the mouse referenced by the handle, but none of the functions I’m using provide me with the copied mouse’s id (or type).

MY QUESTION:

  • Would it be sufficient to continue doing it this way, but move the mouse to 0,0 first, hiding it, and moving it back to it’s original location upon un-hiding? (Unhiding is accomplished by simply moving the mouse)
  • Would a mouse at 0,0 always be an OCR_NORMAL mouse? (The standard arrow.)
  • If not, how could the mouse type/id be found to enable me to replace the proper mouse with the proper handle?

SOURCE:

[DllImport("user32.dll")]
public static extern IntPtr LoadCursorFromFile(string lpFileName);
[DllImport("user32.dll")]
public static extern bool SetSystemCursor(IntPtr hcur, uint id);
[DllImport("user32.dll")]
static extern bool GetCursorInfo(out CURSORINFO pci);

[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public Int32 x;
public Int32 y;
}

[StructLayout(LayoutKind.Sequential)]
struct CURSORINFO
{
public Int32 cbSize;        // Specifies the size, in bytes, of the structure. 
// The caller must set this to Marshal.SizeOf(typeof(CURSORINFO)).
public Int32 flags;         // Specifies the cursor state. This parameter can be one of the following values:
//    0             The cursor is hidden.
//    CURSOR_SHOWING    The cursor is showing.
public IntPtr hCursor;          // Handle to the cursor. 
public POINT ptScreenPos;       // A POINT structure that receives the screen coordinates of the cursor. 
}

private POINT cursorPosition;
private IntPtr cursorHandle;
private bool mouseVisible = false;
private const uint OCR_NORMAL = 32512;

//Get the current mouse, so we can replace it once we want to show the mouse again.
CURSORINFO pci;
pci.cbSize = Marshal.SizeOf(typeof(CURSORINFO));
GetCursorInfo(out pci);
cursorPosition = pci.ptScreenPos;
cursorHandle = CopyIcon(pci.hCursor);

//Overwrite the current normal cursor with a blank cursor to "hide" it.
IntPtr cursor = LoadCursorFromFile(@"./Resources/Cursors/blank.cur");
SetSystemCursor(cursor, OCR_NORMAL);
mouseVisible = false;

//PROCESSING...

//Show the mouse with the mouse handle we copied earlier.
bool retval = SetSystemCursor(cursorHandle, OCR_NORMAL);
mouseVisible = true;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T18:29:40+00:00Added an answer on June 3, 2026 at 6:29 pm

    One application can’t affect another applications cursor. You’d have to write a mouse driver of some sort in order to do this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background to question: We are building an online web application that requires the user
BACKGROUND I am writing a screen capture application My code is based derived from
Background, Part 1 I have a form that collects both frequency and duration from
background: I work on an asp.net web application that is on a company intranet.
Background I am trying to create a copy of a business object I have
Background I admit, this question stems from an ultimate lack of deep understanding of
Background I have a dimension table that has a single record for each day.
Background: I'm writing a 'standard' (nothing special) web application in Ruby (not Rails) and
Background: I have a css and a js that is used only by the
Background I have a ror application which is continuously recording and showing on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.