home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 6_2008-2009.ISO / data / zips / How_to_get2160398202009.psc / gmf / frmMain.frm next >
Text File  |  2009-08-20  |  11KB  |  277 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Get All Info of supported Media files!"
  5.    ClientHeight    =   5745
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   10530
  9.    BeginProperty Font 
  10.       Name            =   "Courier New"
  11.       Size            =   8.25
  12.       Charset         =   0
  13.       Weight          =   400
  14.       Underline       =   0   'False
  15.       Italic          =   0   'False
  16.       Strikethrough   =   0   'False
  17.    EndProperty
  18.    Icon            =   "frmMain.frx":0000
  19.    LinkTopic       =   "Form1"
  20.    LockControls    =   -1  'True
  21.    MaxButton       =   0   'False
  22.    MinButton       =   0   'False
  23.    ScaleHeight     =   5745
  24.    ScaleWidth      =   10530
  25.    StartUpPosition =   2  'CenterScreen
  26.    Begin VB.CommandButton cmdExit 
  27.       Caption         =   "Exit"
  28.       Height          =   360
  29.       Left            =   9510
  30.       TabIndex        =   12
  31.       ToolTipText     =   "Close Application"
  32.       Top             =   5205
  33.       Width           =   945
  34.    End
  35.    Begin VB.Frame Frame2 
  36.       Caption         =   "Option Export"
  37.       Height          =   705
  38.       Left            =   5865
  39.       TabIndex        =   9
  40.       Top             =   4995
  41.       Width           =   2160
  42.       Begin VB.PictureBox PicBack02 
  43.          BorderStyle     =   0  'None
  44.          Height          =   465
  45.          Left            =   45
  46.          ScaleHeight     =   465
  47.          ScaleWidth      =   2070
  48.          TabIndex        =   10
  49.          Top             =   195
  50.          Width           =   2070
  51.          Begin VB.CheckBox ChckSavetoFile 
  52.             Caption         =   "Save result Media to File"
  53.             Height          =   345
  54.             Left            =   45
  55.             TabIndex        =   11
  56.             ToolTipText     =   "Save the result into File TXT"
  57.             Top             =   75
  58.             Width           =   1980
  59.          End
  60.       End
  61.    End
  62.    Begin VB.CommandButton cmdBrowser 
  63.       Caption         =   "..."
  64.       Height          =   255
  65.       Left            =   9990
  66.       TabIndex        =   8
  67.       ToolTipText     =   "Browse All Supported Media file"
  68.       Top             =   4710
  69.       Width           =   450
  70.    End
  71.    Begin VB.Frame Frame1 
  72.       Caption         =   "Option Info"
  73.       Height          =   720
  74.       Left            =   90
  75.       TabIndex        =   3
  76.       Top             =   4995
  77.       Width           =   5760
  78.       Begin VB.PictureBox PicBack 
  79.          BorderStyle     =   0  'None
  80.          Height          =   480
  81.          Left            =   30
  82.          ScaleHeight     =   480
  83.          ScaleWidth      =   5685
  84.          TabIndex        =   4
  85.          Top             =   195
  86.          Width           =   5685
  87.          Begin VB.OptionButton optGetInfo 
  88.             Caption         =   "Full and Short Info"
  89.             Height          =   285
  90.             Index           =   2
  91.             Left            =   2805
  92.             TabIndex        =   7
  93.             ToolTipText     =   "Get Full and Short Info of Media file"
  94.             Top             =   105
  95.             Width           =   2355
  96.          End
  97.          Begin VB.OptionButton optGetInfo 
  98.             Caption         =   "Short Info"
  99.             Height          =   285
  100.             Index           =   1
  101.             Left            =   1395
  102.             TabIndex        =   6
  103.             ToolTipText     =   "Get Short Info of Media file"
  104.             Top             =   105
  105.             Width           =   1440
  106.          End
  107.          Begin VB.OptionButton optGetInfo 
  108.             Caption         =   "Full Info"
  109.             Height          =   285
  110.             Index           =   0
  111.             Left            =   60
  112.             TabIndex        =   5
  113.             ToolTipText     =   "Get Full Info of Media file"
  114.             Top             =   105
  115.             Value           =   -1  'True
  116.             Width           =   1320
  117.          End
  118.       End
  119.    End
  120.    Begin VB.CommandButton cmdGetInfo 
  121.       Caption         =   "Get Info"
  122.       Enabled         =   0   'False
  123.       Height          =   360
  124.       Left            =   8115
  125.       TabIndex        =   2
  126.       ToolTipText     =   "get Info of Media selected"
  127.       Top             =   5205
  128.       Width           =   1245
  129.    End
  130.    Begin VB.TextBox txtMedia_Path 
  131.       Height          =   270
  132.       Left            =   90
  133.       TabIndex        =   1
  134.       ToolTipText     =   "Path of Media file"
  135.       Top             =   4710
  136.       Width           =   9840
  137.    End
  138.    Begin VB.TextBox txtBody 
  139.       Height          =   4545
  140.       Left            =   90
  141.       MultiLine       =   -1  'True
  142.       ScrollBars      =   3  'Both
  143.       TabIndex        =   0
  144.       ToolTipText     =   "Body text"
  145.       Top             =   75
  146.       Width           =   10290
  147.    End
  148. End
  149. Attribute VB_Name = "frmMain"
  150. Attribute VB_GlobalNameSpace = False
  151. Attribute VB_Creatable = False
  152. Attribute VB_PredeclaredId = True
  153. Attribute VB_Exposed = False
  154. Option Explicit
  155.  
  156. Private InfoMediadll As String
  157. Private defPath As String
  158. Private Sub cmdBrowser_Click()
  159.     Dim mediaFileName As String
  160.     If defPath = Empty Then defPath = App.Path + "\"
  161.     mediaFileName = DialogOpenFile("All Media Files" + Chr$(0) + "*.mpeg;*.wmv;*.divx;*.dat;*.mpx;*.asf;*.avi;*.mov;" _
  162.     & "*.mpg;*.mp3;*wma;*wav;*.mid;*.mp4;*.mp2;*.mkv;*.flac;*.ogg;*.vob;*.mka;*.mks;*.ogm;*.mpgv;*.mpv;*.m1v;" _
  163.     & "*.m2v;*.qt;*.rm;*.rmvb;*.ra;*.ifo;*.ac3;*.dts;*.aac;*.ape;*.mac;*.aiff;*.aifc;*.au;*.iff;*.svx8;*.sv16;" _
  164.     & "*.paf;*.sd2;*.irca;*.w64;*.mat;*.pvf;*.xi;*.sds;*.avr" + Chr$(0), defPath)
  165.     If mediaFileName = Empty Then Exit Sub
  166.     defPath = GetFilePath(mediaFileName, Only_Path)
  167.     txtMedia_Path.Text = mediaFileName
  168.     cmdGetInfo.Enabled = True
  169. End Sub
  170.  
  171. Private Sub cmdExit_Click()
  172.     Unload Me
  173. End Sub
  174.  
  175. Private Sub cmdGetInfo_Click()
  176.     Dim display As String
  177.     Dim Handle As Long
  178.     
  179.     '/// Cleat Text Body
  180.     '/// *****************************************************************
  181.     txtBody.Text = Empty
  182.     
  183.     Handle = MediaInfo_Open(StrPtr(txtMedia_Path.Text))
  184.     
  185.     display = InfoMediadll
  186.     
  187.     If optGetInfo(1).Value = True Then
  188.         '/// Get short Info of Media file
  189.         '/// *****************************************************************
  190.         display = display + "Get (Short Info)..." + vbCrLf
  191.         display = display + "------------------------------------------------" + vbCrLf
  192.         Call MediaInfo_Option(Handle, StrPtr("Complete"), StrPtr(""))
  193.         display = display + StripStrinCtoVB(MediaInfo_Inform(Handle, InformOption_Nothing))
  194.     ElseIf optGetInfo(0).Value = True Then
  195.         '/// Get full Info of Media file
  196.         '/// *****************************************************************
  197.         display = display + "Get (Full Info)..." + vbCrLf
  198.         display = display + "------------------------------------------------" + vbCrLf
  199.         Call MediaInfo_Option(Handle, StrPtr("Complete"), StrPtr("1"))
  200.         display = display + StripStrinCtoVB(MediaInfo_Inform(Handle, InformOption_Nothing))
  201.     ElseIf optGetInfo(2).Value = True Then
  202.         '/// Get short and full Info of Media file
  203.         '/// *****************************************************************
  204.         display = display + "Get (Full and Short Info)..." + vbCrLf
  205.         display = display + "------------------------------------------------" + vbCrLf
  206.         Call MediaInfo_Option(Handle, StrPtr("Complete"), StrPtr(""))
  207.         display = display + StripStrinCtoVB(MediaInfo_Inform(Handle, InformOption_Nothing))
  208.         Call MediaInfo_Option(Handle, StrPtr("Complete"), StrPtr("1"))
  209.         display = display + StripStrinCtoVB(MediaInfo_Inform(Handle, InformOption_Nothing))
  210.     End If
  211.   
  212.     '/// Close MediaInfo.dll
  213.     '/// *****************************************************************
  214.     display = display + "------------------------------------------------" + vbCrLf
  215.     display = display + vbCrLf + "Close MediaInfo.dll..."
  216.     Call MediaInfo_Close(Handle)
  217.  
  218.     '/// Displaying the text Result of Media file
  219.     '/// *****************************************************************
  220.     txtBody.Text = display
  221.     
  222.     '/// If ChckSavetoFile value = 1 then Save the Info File
  223.     '/// *****************************************************************
  224.     Dim sFileName As String: Dim strFileName As String
  225.     If ChckSavetoFile.Value = 1 Then
  226.         strFileName = Mid$(GetFilePath(txtMedia_Path.Text, Only_FileName_and_Extension), _
  227.         1, Len(GetFilePath(txtMedia_Path.Text, Only_FileName_and_Extension)) - 4)
  228.         'sFileName = DialogSaveAs(App.Path & "\", Mid$(strFileName, 1, Len(strFileName) - 4))
  229.         'If sFileName = Empty Then Exit Sub
  230.         Open App.Path + "\" + strFileName + ".txt" For Output As #1
  231.             Print #1, display
  232.         Close #1
  233.         MsgBox "Media Info file created in _/" & App.Path & vbCr & "File _/" & strFileName & ".txt", vbInformation, App.Title
  234.     End If
  235.     display = Empty
  236. Exit Sub
  237. End Sub
  238.  
  239. Private Sub Form_Initialize()
  240.     '/// Init Controls XP/Vista Manifest
  241.     '/// *****************************************************************
  242.     Call InitCommonControlsVB
  243. End Sub
  244.  
  245. Private Sub Form_Load()
  246.     
  247.     '/// Verify if the DLL is in the current Path
  248.     '/// *****************************************************************
  249.     If FileExists(App.Path + "\MediaInfo.dll") = False Then
  250.             MsgBox "Sorry, the MediaInfo.dll not found in the current path!" & vbCr _
  251.             & "Put the {MediaInfo.dll} into current path before runnig this Application!", vbExclamation, App.Title
  252.         Unload Me
  253.     End If
  254.     
  255.     '/// Get the MediaInfo.dll Info version
  256.     '/// *****************************************************************
  257.     InfoMediadll = "Init MediaInfo.dll" + vbCrLf + vbCrLf
  258.     InfoMediadll = InfoMediadll + StripStrinCtoVB(MediaInfo_Option(0, StrPtr("Info_Version"), StrPtr(""))) + vbCrLf
  259.     InfoMediadll = InfoMediadll + "------------------------------------------------" + vbCrLf + vbCrLf
  260.     '/// Displaying the text Result of Media file
  261.     '/// *****************************************************************
  262.     txtBody.Text = InfoMediadll
  263.     
  264.     Exit Sub
  265. End Sub
  266.  
  267.  
  268. Private Sub Form_Terminate()
  269.     End
  270. End Sub
  271.  
  272. Private Sub Form_Unload(Cancel As Integer)
  273.     End
  274. End Sub
  275.  
  276.  
  277.