Is .NET CF Wait Cursor Available?

M

Michael Billard

In MFC, you can call CCmdTarget::BeginWaitCursor() to
bring up the wait cursor for your app. This also works on
the Pocket PC, but I cannot find the equivalent function
for .NET CF. The closest I've found is Form.Icon, but I
cannot find anything that will display the animated
hourglass on the Pocket PC. Any ideas? Thanks.
 
S

Simone

Try this code. It's a snippet from the IBuySpy sample.

Imports System
Imports System.Runtime.InteropServices

Public Class Cursor

Declare Function LoadCursor Lib "coredll.dll" (ByVal zeroValue As
Integer, ByVal cursorID As Integer) As Integer
Declare Function SetCursor Lib "coredll.dll" (ByVal cursorHandle As
Integer) As Integer

Public Shared Sub ShowWaitCursor(ByVal bShowCursor As Boolean)
Dim cursorHandle As Integer = 0

If bShowCursor Then
Const hourGlassCursorID As Integer = 32514
cursorHandle = LoadCursor(0, hourGlassCursorID)
End If

SetCursor(cursorHandle)
End Sub 'ShowWaitCursor
End Class 'Cursor

HIH,
Simone
 
W

William Ryan

Cursors.WaitCursor or Cursors.Default

You can also get it through an API call, but the above is a little easier
out of the box...
public WaitCursor()

{

//

// TODO: Constructor,We don't need no stinkin Constructory

//

}



/// <summary>

/// Dll call to LoadCursor

/// </summary>

/// <param name="instance"></param>

/// <param name="nCursorNum"></param>

/// <returns></returns>

[DllImport("coredll.dll")]

private static extern int LoadCursor(int instance, int nCursorNum);

/// <summary>

/// Dll call to SetCursor

/// </summary>

/// <param name="nCursorNum"></param>

/// <returns></returns>

[DllImport("coredll.dll")]

private static extern int SetCursor(int nCursorNum);

/// <summary>

/// Turn the wait cursur on

/// </summary>

public static void WaitCursorOn()

{

//Sets the waitcursor :


SetCursor(LoadCursor(0, 32514));

}

/// <summary>

/// Turn the wait cursor off

/// </summary>

public static void WaitCursorOff()

{

//Removes the waitcursor:

SetCursor(0);

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top