none
[VB6][API] AVI 파일의 해상도 읽어오기 RRS feed

답변

  • Private Const OF_SHARE_DENY_WRITE As Long = &H20

    Private Type AVIFileInfo

        dwMaxBytesPerSec As Long
        dwFlags As Long
        dwCaps As Long
        dwStreams As Long
        dwSuggestedBufferSize As Long
        dwWidth As Long
        dwHeight As Long
        dwScale As Long
        dwRate As Long
        dwLength As Long
        dwEditCount As Long
        szFileType As String * 64
    End Type

    Private Declare Function AVIFileOpen Lib "avifil32" Alias "AVIFileOpenA" (ppfile As Long, ByVal szFile As String, ByVal mode As Long, pclsidHandler As Any) As Long

    Private Declare Function AVIFileRelease Lib "avifil32" (ByVal pfile As Long) As Long


    Private Declare Function AVIFileInfo Lib "avifil32" Alias "AVIFileInfoA" (ByVal pfile As Long, pfi As AVIFileInfo, ByVal lSize As Long) As Long


    Private Declare Sub AVIFileInit Lib "avifil32" ()


    Private Declare Sub AVIFileExit Lib "avifil32" ()


    Private Sub Form_Load()

        Dim hFile As Long, AviInfo As AVIFileInfo
        AVIFileInit
        If AVIFileOpen(hFile, "C:\SIERRA\Half-Life\valve\media\sierra.avi", OF_SHARE_DENY_WRITE, ByVal 0&) = 0 Then
            If AVIFileInfo(hFile, AviInfo, Len(AviInfo)) = 0 Then
                MsgBox "AVI 해상도 크기: " + CStr(AviInfo.dwWidth) + "x" + CStr(AviInfo.dwHeight)
            Else
                MsgBox "AVI 정보를 받는 도중 에러가 발생했습니다. :("
            End If
            AVIFileRelease hFile
        Else
            MsgBox "AVI 파일을 여는 도중 에러가 발생했습니다. :("
        End If
        AVIFileExit
    End Sub

    • 답변으로 표시됨 devlife 2012년 6월 29일 금요일 오전 10:51
    2012년 6월 29일 금요일 오전 10:49