1 ممكن طلب 6 فبراير 2005، 15:55 ممكن كود لاستدعاء ملفات الفيديو وذلك باختيار الملف ارجو ان يكون طلبي عندكم والسلام عليكم ورحمة الله وبركاته.
2 6 فبراير 2005، 22:56 هذي بعض الأكواد ربما تفيدك في التعامل مع الفيديو 1- تشغيل ملف فيديو كود المصدر 'Add a module to your project (In the menu choose Project -> Add Module, Then click Open) 'Add 2 CommandButtons to your form (named Command1 and Command2). 'When you press the first button the AVI movie will start to play. 'Even after the AVI Finish playing, it is still takes memory. 'To remove it from the memory press the second button. 'Insert this code to the module : Declare Function mciSendString Lib "winmm.dll" Alias _ "mciSendStringA" (ByVal lpstrCommand As String, ByVal _ lpstrReturnString As String, ByVal uReturnLength As Long, _ ByVal hwndCallback As Long) As Long 'Insert the following code to your form: Private Sub Command1_Click() Dim returnstring As String Dim FileName As String returnstring = Space(127) 'Replace c:\MyMovie.avi with the AVI file you want to play FileName = "c:\MyMovie.avi" erg = mciSendString("open " & Chr$(34) & FileName & _ Chr$(34) & " type avivideo alias video", returnstring, 127, 0) erg = mciSendString("set video time format ms", returnstring, 127, 0) erg = mciSendString("play video from 0", returnstring, 127, 0) End Sub Private Sub Command2_Click() erg = mciSendString("close video", returnstring, 127, 0) End Sub عرض الكل 2- تشغيل ملف فيديو في صندوق الصورة كود المصدر Private Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" _ (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _ ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long Private Declare Function mciGetErrorString Lib "winmm" Alias _ "mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As String, _ ByVal uLength As Long) As Long Private Declare Function GetShortPathName Lib "kernel32" Alias _ "GetShortPathNameA" (ByVal lpszLongPath As String, _ ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long Private Const WS_CHILD = &H40000000 Private Sub PlayAVIPictureBox(FileName As String, ByVal Window As PictureBox) Dim RetVal As Long Dim CommandString As String Dim ShortFileName As String * 260 Dim deviceIsOpen As Boolean 'Retrieve short file name format RetVal = GetShortPathName(FileName, ShortFileName, Len(ShortFileName)) FileName = Left$(ShortFileName, RetVal) 'Open the device CommandString = "Open " & FileName & " type AVIVideo alias AVIFile parent " _ & CStr(Window.hWnd) & " style " & CStr(WS_CHILD) RetVal = mciSendString(CommandString, vbNullString, 0, 0&) If RetVal Then GoTo error 'remember that the device is now open deviceIsOpen = True 'Resize the movie to PictureBox size CommandString = "put AVIFile window at 0 0 " & CStr(Window.ScaleWidth / _ Screen.TwipsPerPixelX) & " " & CStr(Window.ScaleHeight / _ Screen.TwipsPerPixelY) RetVal = mciSendString(CommandString, vbNullString, 0, 0&) If RetVal <> 0 Then GoTo error 'Play the file CommandString = "Play AVIFile wait" RetVal = mciSendString(CommandString, vbNullString, 0, 0&) If RetVal <> 0 Then GoTo error 'Close the device CommandString = "Close AVIFile" RetVal = mciSendString(CommandString, vbNullString, 0, 0&) If RetVal <> 0 Then GoTo error Exit Sub error: 'An error occurred. 'Get the error description Dim ErrorString As String ErrorString = Space$(256) mciGetErrorString RetVal, ErrorString, Len(ErrorString) ErrorString = Left$(ErrorString, InStr(ErrorString, vbNullChar) - 1) 'close the device if necessary If deviceIsOpen Then CommandString = "Close AVIFile" mciSendString CommandString, vbNullString, 0, 0& End If 'raise a custom error, with the proper description Err.Raise 999, , ErrorString End Sub Private Sub Command1_Click() 'replace 'c:\myfile.avi' with the name of the AVI file you want to play PlayAVIPictureBox "c:\goeye.avi", Picture1 End Sub عرض الكل 3- لتشغيل ملف فيديو في Picture كود المصدر Private Sub Form_Load() MMControl1.FileName = ("c:\FileName.dat") MMControl1.Command = "open" MMControl1.hWndDisplay = Picture1.hWnd End Sub نتمنى أن تكون قد استفدت من هذه الأكواد