home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / curs_man / cursmang.bas < prev    next >
BASIC Source File  |  1992-09-12  |  3KB  |  89 lines

  1. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. '
  3. 'This Demo is copyrighed by Pierre Fillion 1992
  4.  
  5. 'CURSMAN (Cursor Manipulations) will show you:
  6.  
  7. 'How to get real cursor positions (positions of the entire screen)
  8. 'How to clip a cursor into a part of the screen
  9. 'How to hide and restore cursor (this won't disable it just hide it)
  10. 'How to move the cursor to specific location on the screen
  11.  
  12. 'I released the source of this demo to show the use of api calls for cursor
  13. 'manipulations. Many hours have been spend to create this demo to make it
  14. 'public. Feel free to use part of the code as long as you send a donation.
  15.  
  16. 'Thanks a lot.
  17.  
  18. 'Pierre Fillion
  19. '8460 Perras Apt1
  20. 'Montreal, Quebec
  21. 'Canada, H1E 5C7
  22.  
  23. 'Questions, suggestions ?? Go Ahead. CIS ID:71162,51
  24.  
  25. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  26.  
  27. 'NOTES:
  28. '
  29. '  1- The routine to hide the cursor don't disable it, the cursor still
  30. '     active but hidden.
  31. '
  32. '     To enables or disables mouse and keyboard input to the specified window
  33. '     or control use this API call on one line.
  34.  
  35. '     Declare Function EnableWindow Lib "User"
  36. '     (ByVal hWnd As Integer, ByVal aBOOL As Integer) As Integer
  37.  
  38. '     When input is disable, input such as mouse clicks and key presses
  39. '     are ignored by the window. When input is enabled, all input is processed.
  40.  
  41. '  2- If you clip the cursor, you won't be able to move it out of the form, but
  42. '     if you drag the form you will see that the clipped area disapeared. It's
  43. '     because, by moving the frame windows reseted the clipped area. To prevent
  44. '     this, just set the top of the clipping area for the form to disallow cursor
  45. '     from reaching it.
  46.  
  47. '  3- If you exit the program without unclipping, the cursor will be restricted
  48. '     to the clipped area. Just call the unclip routines in you program when you
  49. '     you exit them.
  50.  
  51. '     I didn't fixed the two previous notes because I found it nice to let you
  52. '     take a look at them.
  53.  
  54. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  55.  
  56.  
  57.  
  58. 'Cursor Types for Records
  59. Type POINTAPI
  60. x As Integer
  61. Y As Integer
  62. End Type
  63.  
  64. Type RECT
  65. Left As Integer
  66. Top As Integer
  67. Right As Integer
  68. Bottom As Integer
  69. End Type
  70.  
  71. 'Cursor Record for API calls
  72. Global Pos As POINTAPI
  73. Global TPos As POINTAPI
  74. Global ClipWin As RECT
  75.  
  76. 'Cursor constants
  77. Global Const C_HIDE = 0
  78. Global Const C_SHOW = -1
  79. Global C_State As Integer 'State of the cursor - hidden of not
  80.  
  81. 'API declaration for cursor manipulations
  82. Declare Sub GetCursorPos Lib "User" (lpPoint As POINTAPI)
  83. Declare Function SetCursorPos Lib "User" (ByVal x%, ByVal Y%) As Integer
  84. Declare Function ShowCursor Lib "User" (ByVal State%) As Integer
  85. Declare Sub ClipCursor Lib "User" (lpRect As Any)
  86.  
  87.  
  88.  
  89.