Keep Mouse Cursor Inside a Form or Control

Category:
System/API
Type:
Snippets
Difficulty:
Intermediate
Author:
Anonymous

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
Pass the hWnd property of the form or control to this function, and you won't be able to move the mouse outside of it.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: