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))
+ Reply to Thread
Results 1 to 2 of 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!!!
Similar Threads
-
sony DAV-HDX589W multi code zone code
By sam1821 in forum DVD & Blu-ray PlayersReplies: 4Last Post: 7th May 2010, 15:37 -
testing thecoalman's suggestion of [code=php] test [/code] ... FAILED!
By vhelp in forum TestReplies: 1Last Post: 10th Jun 2009, 01:15 -
Need code for pioneeer bdp lx70 code for multi region ...
By SHERWOODSelectrical in forum DVD & Blu-ray PlayersReplies: 2Last Post: 21st Nov 2008, 12:42 -
PHP code used to generate code for Avysinth join mov and avi files
By lindylex in forum User guidesReplies: 0Last Post: 19th Sep 2008, 03:37 -
HTML code suitable for different sized Monitors; also code to embed
By wiseant in forum Off topicReplies: 3Last Post: 8th May 2008, 18:14