Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ClipCursor Problem with VB5 and NT4

Status
Not open for further replies.

GMcC

Programmer
Sep 20, 1999
2
GB
Please help....<br>
<br>
While converting an application from VB3 (16bit API) to VB5 (32bit API) code used to restrict movement of the cursor using ClipCursor API call no longer works.<br>
<br>
The code executes without any apparent error but the cursor movement is not restricted to the area of the form being loaded. <br>
<br>
The code itself was unchanged during the conversion. A copy of the code is shown below.<br>
<br>
******************** Start of Code *********************<br>
Private Sub Form_Load()<br>
<br>
Dim CursorClippedArea As CursorArea<br>
Dim bOk As Integer<br>
<br>
' Set form position<br>
' =================<br>
Me.Top = Screen.ActiveForm.Top + (Screen.ActiveForm.Height / 2) - (Me.Height / 2)<br>
Me.Left = Screen.ActiveForm.Left + (Screen.ActiveForm.Width / 2) - (Me.Width / 2)<br>
<br>
Me.Refresh<br>
<br>
' Set cursor area to be the size of this form<br>
' ===========================================<br>
CursorClippedArea.Left = CLng(Me.Left / Screen.TwipsPerPixelX)<br>
CursorClippedArea.Top = CLng(Me.Top / Screen.TwipsPerPixelY)<br>
CursorClippedArea.Right = CLng((Me.Left + Me.Width) / Screen.TwipsPerPixelX)<br>
CursorClippedArea.Bottom = CLng((Me.Top + Me.Height) / Screen.TwipsPerPixelY)<br>
<br>
' Call the API Function<br>
' =====================<br>
bOk = ClipCursor(CursorClippedArea)<br>
<br>
DoEvents<br>
<br>
End Sub<br>
******************** End of Code *********************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top