VideoHelp Forum




+ Reply to Thread
Results 1 to 2 of 2
  1. Member
    Join Date
    Nov 2005
    Location
    Canada
    Search Comp PM
    I am Writing a Media Player in C# and i am usign Winmm.dll. I need to get the Size of AVI or any other video file. I found this code but having hard time converting to C#.

    Please advise me, if their is better way to get the size.

    thanks in advance.



    http://www.devx.com/vb2themax/Tip/18387

    To retrieve the original size of an AVI file that you've already opened with the mciSendString API function you can use this command

    Dim RetString As String
    RetString = Space$(256)
    CommandString = "where AVIFile destination"
    RetVal = mciSendString(CommandString, RetString, Len(RetString), 0)

    Notice that in this case you've to pas a non-null RetString and his length in the second and third parameter respectively. When the function returns, it will contain the four coordinates (X1 Y1 X2 Y2) of the area used by the movie, for instance

    "0 0 320 240"

    indicates that the width is 320 and height 240 pixel. To extract this information you must extract the null terminated string out of the buffer, and then parse the result. If you're using VB6 you can write a concise code that does it as follows:

    ' extract the null-terminated string
    RetString = Left$(RetString, InStr(RetString & vbNullChar, vbNullChar) - 1)
    ' return the information in a zero-based array of strings
    Dim res() As String
    res() = Split(RetString)
    ' width is in the 3rd element, height is in the 4th element
    width = CSng(res(2))
    height = CSng(res(3))
    Quote Quote  
  2. Hi,

    Do a search on google for VB to C# Converter software! I know there's software available for converting between VB.NET to C# or vice versa, there's also a programme available that will convert C#, VB, VB.NET to Delphi (this is the one i use!).

    I'm sure i've seen it somewhere where you can convert VB to C# if not there is definitely software available that will upgrade a VB project to VB.NET project and then you can convert it to C#. I've done this once before (about 7 months ago) and it worked very well!

    Good Luck!!!
    For Queen and Country!!!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!