Private Sub Form_Load()
'--------------------------------------------------------
ShowCursor (False) '为什么加上这行就说子程序或函数为定义?
'--------------------------------------------------------
ShockwaveFlash1.Top = 0
ShockwaveFlash1.Left = 0
Form1.Top = 0
Form1.Left = 0
Form1.Width = Screen.Width
Form1.Height = Screen.Height
MediaPlayer1.Top = 855
MediaPlayer1.Left = 0
With ShockwaveFlash1
.Movie = App.Path + "\zm.swf"
.Play
End With
MediaPlayer1.Width = Form1.WidthMediaPlayer1.Height = Form1.Height - 855
ShockwaveFlash1.Width = Form1.WidthMediaPlayer1.SendPlayStateChangeEvents = False
MediaPlayer1.FileName = App.Path & "/10.mpeg"
MediaPlayer1.Play
End Sub
Private Sub MediaPlayer1_EndOfStream(ByVal Result As Long)
Unload Me
End Sub
Private Sub MediaPlayer1_Error()
Unload Me
End Sub
========================================================
如果这重方法不行,那么改怎么隐藏鼠标?
'--------------------------------------------------------
ShowCursor (False) '为什么加上这行就说子程序或函数为定义?
'--------------------------------------------------------
ShockwaveFlash1.Top = 0
ShockwaveFlash1.Left = 0
Form1.Top = 0
Form1.Left = 0
Form1.Width = Screen.Width
Form1.Height = Screen.Height
MediaPlayer1.Top = 855
MediaPlayer1.Left = 0
With ShockwaveFlash1
.Movie = App.Path + "\zm.swf"
.Play
End With
MediaPlayer1.Width = Form1.WidthMediaPlayer1.Height = Form1.Height - 855
ShockwaveFlash1.Width = Form1.WidthMediaPlayer1.SendPlayStateChangeEvents = False
MediaPlayer1.FileName = App.Path & "/10.mpeg"
MediaPlayer1.Play
End Sub
Private Sub MediaPlayer1_EndOfStream(ByVal Result As Long)
Unload Me
End Sub
Private Sub MediaPlayer1_Error()
Unload Me
End Sub
========================================================
如果这重方法不行,那么改怎么隐藏鼠标?
DefLng A-ZDim Cursor As cCursor
Private Sub cmdVisible_Click()
Cursor.Visible = Not Cursor.VisibleEnd SubPrivate Sub Form_Load()Set Cursor = New cCursorEnd SubPrivate Sub txtX_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then
KeyAscii = 0
Cursor.X = Val(txtX)
End IfEnd Sub
以下为模块内函数'===============cCursor.cls===============
'Purpose: To provide quick and easy access
' to cursor functions.
'
'Functions/Subs/Properties:
' -- X (Get/Let): Sets cursor X position
' -- Y (Get/Let): Sets cursor Y position
' -- SnapTo: Puts a cursor in the center
' of a control.
' -- ClipTo: Restricts the cursor to any
' square area of movement.
'=========================================Option Explicit
DefLng A-ZPrivate Type POINTAPI
X As Long
Y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private CurVisible As Boolean
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function ClientToScreen Lib "user32" (ByVal hWnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function ClipCursor Lib "user32" (lpRect As RECT) As Long
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As LongPublic Property Get X() As LongDim tmpPoint As POINTAPI
Call GetCursorPos(tmpPoint)
X = tmpPoint.XEnd PropertyPublic Property Let X(ByVal vNewValue As Long)Call SetCursorPos(vNewValue, Y)End PropertyPublic Property Get Y() As LongDim tmpPoint As POINTAPI
Call GetCursorPos(tmpPoint)
Y = tmpPoint.YEnd PropertyPublic Property Let Y(ByVal vNewValue As Long)Call SetCursorPos(X, vNewValue)End PropertyPublic Sub SnapTo(ctl As Control)'Snaps the cursor to the center of
'a given control.Dim pnt As POINTAPI
Dim xx As Long
Dim yy As Longpnt.X = pnt.Y = 0
'Get Left-Top corner of control
Call ClientToScreen(ctl.hWnd, pnt)
xx = pnt.X + (ctl.Width \ 2)
yy = pnt.Y + (ctl.Height \ 2)
'xx = pnt.X + ctl.Width / (2 * (Screen.ActiveForm.Left + ctl.Left) / pnt.X)
'yy = pnt.Y + ctl.Height / (2 * (Screen.ActiveForm.Top + ctl.Top) / pnt.Y)
Call SetCursorPos(xx, yy)End SubPublic Sub ClipTo(ToCtl As Object)On Error Resume NextDim tmpRect As RECT
Dim pt As POINTAPIWith ToCtl If TypeOf ToCtl Is Form Then
tmpRect.Left = (.Left \ Screen.TwipsPerPixelX)
tmpRect.Top = (.Top \ Screen.TwipsPerPixelY)
tmpRect.Right = (.Left + .Width) \ Screen.TwipsPerPixelX
tmpRect.Bottom = (.Top + .Height) \ Screen.TwipsPerPixelY
ElseIf TypeOf ToCtl Is Screen Then
tmpRect.Left = 0
tmpRect.Top = 0
tmpRect.Right = (.Width \ Screen.TwipsPerPixelX)
tmpRect.Bottom = (.Height \ Screen.TwipsPerPixelY)
Else
pt.X = 0
pt.Y = 0
Call ClientToScreen(.hWnd, pt)
tmpRect.Left = pt.X
tmpRect.Top = pt.Y
pt.X = .Width
pt.Y = .Height
Call ClientToScreen(.hWnd, pt)
tmpRect.Bottom = pt.Y
tmpRect.Right = pt.X
End If
Call ClipCursor(tmpRect)End WithEnd SubPrivate Sub Class_Initialize()CurVisible = TrueEnd SubPublic Property Get Visible() As BooleanVisible = CurVisibleEnd PropertyPublic Property Let Visible(ByVal vNewValue As Boolean)CurVisible = vNewValue
Call ShowCursor(CurVisible)End Property
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
=========================
[email protected]
=========================
=========================================
' Declare necessary API functions.
Declare Function joyGetPosEx Lib "winmm.dll" (ByVal uJoyID As Long, pji As JOYINFOEX) As Long
Declare Function joyReleaseCapture Lib "winmm.dll" (ByVal id As Long) As Long
Declare Function joySetCapture Lib "winmm.dll" (ByVal hWnd As Long, ByVal uID As Long, ByVal uPeriod As Long, ByVal bChanged As Long) As Long
Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long' Declare necessary API constants. Sorry, it's a long list. I don't
' think they are all necessary though.
Public Const JOYSTICKID1 = 0
Public Const JOYSTICKID2 = 1Public Const JOY_POVCENTERED = -1
Public Const JOY_POVFORWARD = 0
Public Const JOY_POVRIGHT = 9000
Public Const JOY_POVLEFT = 27000
Public Const JOY_RETURNX = &H1&
Public Const JOY_RETURNY = &H2&
Public Const JOY_RETURNZ = &H4&
Public Const JOY_RETURNR = &H8&
Public Const JOY_RETURNU = &H10
Public Const JOY_RETURNV = &H20
Public Const JOY_RETURNPOV = &H40&
Public Const JOY_RETURNBUTTONS = &H80&
Public Const JOY_RETURNRAWDATA = &H100&
Public Const JOY_RETURNPOVCTS = &H200&
Public Const JOY_RETURNCENTERED = &H400&
Public Const JOY_USEDEADZONE = &H800&
Public Const JOY_RETURNALL = (JOY_RETURNX Or JOY_RETURNY Or JOY_RETURNZ Or JOY_RETURNR Or JOY_RETURNU Or JOY_RETURNV Or JOY_RETURNPOV Or JOY_RETURNBUTTONS)
Public Const JOY_CAL_READALWAYS = &H10000
Public Const JOY_CAL_READRONLY = &H2000000
Public Const JOY_CAL_READ3 = &H40000
Public Const JOY_CAL_READ4 = &H80000
Public Const JOY_CAL_READXONLY = &H100000
Public Const JOY_CAL_READYONLY = &H200000
Public Const JOY_CAL_READ5 = &H400000
Public Const JOY_CAL_READ6 = &H800000
Public Const JOY_CAL_READZONLY = &H1000000
Public Const JOY_CAL_READUONLY = &H4000000
Public Const JOY_CAL_READVONLY = &H8000000' Declare necessary API data structure. THIS I know is necessary.
Type JOYINFOEX
dwSize As Long ' size of structure
dwFlags As Long ' flags to indicate what to return
dwXpos As Long ' x position
dwYpos As Long ' y position
dwZpos As Long ' z position
dwRpos As Long ' rudder/4th axis position
dwUpos As Long ' 5th axis position
dwVpos As Long ' 6th axis position
dwButtons As Long ' button states
dwButtonNumber As Long ' current button number pressed
dwPOV As Long ' point of view state
dwReserved1 As Long ' reserved for communication between winmm driver
dwReserved2 As Long ' reserved for future expansion
End Type
===========================
然后就直接用SHOWCORUS (TURE)
[email protected]
已发送