Microsoft KB Archive/265798

= How To Change the Cursor in an eMbedded Visual Basic Application =

Article ID: 265798

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft eMbedded Visual Basic 3.0

-



This article was previously published under Q265798





IN THIS TASK
SUMMARY
 * Change Cursor in Visual Basic Application



SUMMARY
This article illustrates how to use the SetCursor and LoadCursor API function calls to change the cursor in an eMbedded Visual Basic 3.0 (eVB) application. This approach is necessary because the Screen.MousePointer property in eVB works only on the Pocket PC device. It does not work on the Handheld PC Professional Edition or the Palm-size PC devices.

Change Cursor in Visual Basic Application
 Create a new Windows CE project in eMbedded Visual Basic. Form1 is created by default. Place two Command buttons on Form1.  Paste the following code into Form1:NOTE: This code works on the Windows CE devices with touch screens but it does not work in the emulation environment. Const IDC_WAIT = 32514

Public Declare Function LoadCursor Lib &quot;Coredll&quot; _ Alias &quot;LoadCursorW&quot; ( _   ByVal hInstance As Long, _    ByVal lpCursorName As Long) As Long

Public Declare Function SetCursor Lib &quot;Coredll&quot; ( _   ByVal hCursor As Long) As Long

Function WaitCursor(bWait As Boolean) As Long Dim hCursor As Long 'Obtain the handle to the cursor If bWait Then 'Get handle to the wait cursor hCursor = LoadCursor(0, IDC_WAIT) Else 'Restore default cursor hCursor = LoadCursor(0, 0) End If   'Set the cursor based on the cursor handle WaitCursor = SetCursor(hCursor)

End Function

Private Sub Command1_Click WaitCursor True End Sub

Private Sub Command2_Click WaitCursor False End Sub

Private Sub Form_Load Command1.Move 120, 120, 2535, 375 Command2.Move 120, 600, 2535, 375 Command1.Caption = &quot;Hourglass&quot; Command2.Caption = &quot;Default&quot; End Sub  Run the application. Click the Command buttons, and note that the cursor changes.

back to the top

Keywords: kbhowto kbhowtomaster KB265798

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.