RE: hide cursor for kiosk application (powerpoint)



Hi M,

Thank you for your reply.

After doing more research, I found out a workaround for this issue, that is
to change the system cursor to a 'transparent' cursor when the application
is run and restore the previous system cursor when the application is
terminated. To set the system cursor, we could use the SetSystemCursor
Win32 function.

The following is a sample.

using System.Runtime.InteropServices;
public partial class Form1 : Form
{
[DllImport("user32.dll")]
static extern bool SetSystemCursor(IntPtr hcur, int id);

[DllImport("user32.dll")]
static extern IntPtr LoadCursorFromFile(string lpFileName);

[DllImport("user32.dll")]
static extern IntPtr GetCursor();

[DllImport("user32.dll")]
static extern IntPtr CopyImage(IntPtr hImage,int uType,int
cxDesired,int cyDesired,int fuFlags);

int OCR_NORMAL = 32512;
int IMAGE_CURSOR = 2;
int LR_COPYDELETEORG = 0x0008;

void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
// restore the system cursor
SetSystemCursor(defaultCur, OCR_NORMAL);
}

private void Form1_Load(object sender, EventArgs e)
{
// get the handle of the current cursor
defaultCur = GetCursor();
// copy the default cursor to restore the system cursor when
the application exits
defaultCur = CopyImage(defaultCur, IMAGE_CURSOR, 0, 0,
LR_COPYDELETEORG);
// load a new transparent cursor
IntPtr hcur = LoadCursorFromFile(Application.StartupPath +
@"\transparent.cur");
// set the system cursor to the new transparent cursor
SetSystemCursor(hcur, OCR_NORMAL);
}
}

I searched the Internet and found a free cursor editor called RealWorld
Cursor Editor. You may use it to create a transparent cursor. You can
download it from the below link:

http://www.freedownloadscenter.com/Shell_and_Desktop/Cursor_Editing_Tools/Re
alWorld_Cursor_Editor.html

Hope this helps.

Sincerely,
Linda Liu
Microsoft Online Community Support

.



Relevant Pages

  • Re: VBScript: How to hide the mouse-Cursor
    ... There is no way to do this using "pure" script. ... What you do is to re-set the system cursor to a cursor ... Dim bAns ' as long ...
    (microsoft.public.scripting.vbscript)
  • RE: hide cursor for kiosk application (powerpoint)
    ... to change the system cursor to a 'transparent' cursor when the application ... static extern bool SetSystemCursor(IntPtr hcur, ... static extern IntPtr GetCursor; ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Getting Cursor Information & the Hot Spot?
    ... This link is a pretty good overview of the various System Cursor routines. ... The problem I am encountering is custom cursors. ... Private Declare Function GetCursorPos Lib "User32.dll" (ByVal lpPoint As ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Drag&Drop and Cursors
    ... Rene Ruppert wrote: ... the default system cursor during drag and drop operations? ... I don't want to replace the complete cursor with my own image and I don't want to use the default copy or move cursors. ... I was thinking about converting the system cursor to an ImageIcon but I don't see a way to do that. ...
    (comp.lang.java.gui)
  • Re: Transparent PNG
    ... Until I decided I wanted to show the mouse cursor. ... I got a screenshot ... Viewing the PNG standalone in Firefox ... the transparent part doesn't show up. ...
    (comp.text.tex)

Loading