Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Intermediate
Nov 13, 1999

Retrieve the size of an AVI movie

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))
Alberto Falossi
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap