📄 form1.frm
字号:
Association ".flv", "image", App.Path & "\" & App.EXEName & ".exe"
'Load height & width from ressources
Form1.Width = (320 * Screen.TwipsPerPixelX)
Form1.Height = (260 * Screen.TwipsPerPixelY) + 375 + Picture3.Height
'Move the resize pic
resizepic.Left = Form1.Width - resizepic.Width
resizepic.Top = Form1.Height - resizepic.Height
Form1.BackColor = &H0&
EnableDragDrop Me.hwnd 'Activation du Drag'n'Drop
Dim Buf As String * 128 'Pour le dossier temporaire
Dim Value As Integer '
Value = GetTempPath(128, Buf) '
tempdir = Left(Buf, Value) '
Randomize Timer 'Pour obtenir des nombres vraiment al閍toires
tempfile = tempdir & Int(Rnd * 100000) + 187 'on g閚鑢e un nom de fichier al閍toire
extractress 101, tempfile 'Extraction de la ressource
'Ajout dynamique du conr鬺e. Consulter ce tuto
'http://www.vbfrance.com/tutoriaux/AJOUTER-CONTROLE-OCX-DYNAMIQUEMENT-PLEINE-EXECUTION-LATE-BINDING_361.aspx
Set ctrl = Form1.Controls.Add("ShockwaveFlash.ShockwaveFlash", "flashplayer")
ctrl.Visible = True
ctrl.Width = 0
ctrl.Height = 0
Call ctrl.LoadMovie(0, tempfile)
ctrl.BackgroundColor = &H0&
ctrl.Menu = False
dragpic.Top = 375
dragpic.Left = 0
dragpic.Height = Form1.Height - Picture3.Height - Picture3.Height
dragpic.Width = Form1.Width
resizepic.Visible = False
'Check the command line
If Not lignecommande("") = "" Then Call GotADrop(lignecommande(""))
End Sub
'To extract the ressource
Public Sub extractress(ress As Integer, nom_fich As String)
Dim tab_ani() As Byte
Open nom_fich For Binary Access Write As 1
tab_ani = LoadResData(ress, "CUSTOM")
ReDim Preserve tab_ani(UBound(tab_ani))
Put 1, , tab_ani
Close 1
End Sub
'When a file is droped into the form
Public Sub GotADrop(ByVal flvfile As String)
flvfile = tempfile & "?file=" & flvfile
flvfile = Replace(flvfile, "\", "/")
Form1.Controls.Remove "flashplayer" 'We remove the control
'And we add another
Set ctrl = Form1.Controls.Add("ShockwaveFlash.ShockwaveFlash", "flashplayer")
ctrl.Visible = True
ctrl.BackgroundColor = &H0&
ctrl.Top = 375
'We set the flashvars
ctrl.FlashVars = "autostart=true"
'We load the flash player
Call ctrl.LoadMovie(0, flvfile)
ctrl.Height = Form1.Height - Picture3.Height
ctrl.Width = Form1.Width
fullscreen.Visible = True
Form1.Width = (320 * Screen.TwipsPerPixelX)
Form1.Height = (240 * Screen.TwipsPerPixelY) + 375 + Picture3.Height
dragpic.Visible = False
resizepic.Visible = True
End Sub
Private Sub Form_Resize()
On Error Resume Next
Static bReEntry As Boolean
If bReEntry Then Exit Sub
bReEntry = True
resizepic.Left = Width - resizepic.Width
resizepic.Top = Height - resizepic.Height
Picture3.Top = Height - Picture3.Height
Picture4.Left = Width - Picture4.Width
ctrl.Height = Form1.Height - Picture3.Height - 375
ctrl.Width = Form1.Width
bReEntry = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
DisableDragDrop Me.hwnd 'D閟activation du Drag'n'Drop
If tempfile <> "" Then Kill tempfile
End Sub
Private Sub mpeg_Click()
Form2.Show
End Sub
Private Sub ctrl_ObjectEvent(info As EventInfo)
Dim i As Long
Dim nbArgs As Long
Dim msg As String
If info.Name = "FSCommand" Then
nbArgs = info.EventParameters.Count
msg = msg & "Evenement : " & info.Name & vbCrLf
If CStr(info.EventParameters(i).Value) = "play" Then status.Caption = "- Playing"
If CStr(info.EventParameters(i).Value) = "pause" Then status.Caption = "- Paused"
For i = 0 To nbArgs - 1
msg = msg & "Argument n. " & CStr(i) & " name = " & _
CStr(info.EventParameters(i).Name & _
" valeur = " & CStr(info.EventParameters(i).Value)) & _
vbCrLf
Next i
End If
End Sub
Private Sub fullscreen_Click()
'Save the current height and width
currentheight = Form1.Height
currentwidth = Form1.Width
largeur% = Screen.Width \ Screen.TwipsPerPixelX
hauteur% = Screen.Height \ Screen.TwipsPerPixelY
Form1.Top = 0
Form1.Left = 0
Form1.Width = (Str$(largeur%) * Screen.TwipsPerPixelX)
Form1.Height = (Str$(hauteur%) * Screen.TwipsPerPixelY)
Picture1.Visible = False
Picture3.Visible = False
ctrl.Top = 0
ctrl.Width = Form1.Width
ctrl.Height = Form1.Height
resizepic.Visible = False
restorepic.Left = Width - Picture4.Width - 1450
restorepic.Visible = True
End Sub
Private Sub Label5_Click()
Call fullscreen_Click
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ValRetour As Long
Call ReleaseCapture 'on appelle l'api ici
ValRetour = SendMessage(Form1.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End Sub
Private Sub resizepic_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
p = 1
End Sub
Private Sub resizepic_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
If p = 1 Then
Width = X + Width
Height = Y + Height
End If
End Sub
Private Sub resizepic_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
p = 0
End Sub
Private Sub Picture4_Click()
Call Form_Unload(0)
End
End Sub
Private Sub OpenFile_Click()
With dlg
.DefaultExt = "flv"
.Filter = "Flash video file (*.flv)|*.flv"
.Flags = cdlOFNExplorer
End With
dlg.ShowOpen
If dlg.FileName = "" Then Exit Sub
GotADrop (dlg.FileName)
End Sub
Private Sub restorepic_Click()
Form1.Width = currentwidth
Form1.Height = currentheight
ctrl.Width = currentwidth
ctrl.Height = currentheight - Picture3.Height
Picture1.Visible = True
Picture3.Visible = True
resizepic.Visible = True
Picture4.Left = Width - Picture4.Width
ctrl.Top = 375
restorepic.Visible = False
End Sub
Private Sub status_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ValRetour As Long
Call ReleaseCapture 'on appelle l'api ici
ValRetour = SendMessage(Form1.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End Sub
Private Sub status_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
p = 1
End Sub
Private Sub status_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
If p = 1 Then
Width = X + Width
Height = Y + Height
End If
End Sub
Private Sub Timer1_Timer()
wid = (320 * Screen.TwipsPerPixelX) + (Form1.Width - Form1.ScaleWidth)
Heig = (260 * Screen.TwipsPerPixelY) + 375 + Picture3.Height
If Me.Width <= wid Then
Me.Width = wid
ctrl.Width = wid
End If
If Me.Height <= Heig Then
Me.Height = Heig
ctrl.Height = Form1.Height - Picture3.Height - 375
End If
ctrl.Height = Form1.Height - Picture3.Height - 375
ctrl.Width = Form1.Width
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -