Official BS.Player forums

Official BS.Player forums (
-   General Talk And Support (
-   -   How to move the movie ??? (

salazar 16th June 2005 10:00 PM

How to move the movie ???
Which constant can i use to move the movie on the screen ?
What type of parameters to use with the send message : need i to give the top and left corner (as right and botton corner), or is ther a constante to translate the movie ?

Tizio 16th June 2005 11:40 PM

I've tested some of my avi files and I've finded the following:
If you want to know the MovieWindowSize of an .AVI file, you have to read the 32bit value at (decimal)offset 64 for the width, and the 32bit value at (decimal)offset 68 for the height.
NOTE: I can't assure you that all the avi files have the dimension information at that offset, but mine yes!

There is a BEEEEETTER way to retrieve information about avi files, and it's through API calls (here is a VisualBasic example taken from API-Guide that retrieves the AVI file window dimesions):


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()
    'KPD-Team 2001
    Dim hFile As Long, AviInfo As AVIFileInfo
    'initialize the AVIFile library
    'create a handle to the AVI file
    If AVIFileOpen(hFile, "C:\PATH\file_name.avi", OF_SHARE_DENY_WRITE, ByVal 0&) = 0 Then
        'retrieve the AVI information
        If AVIFileInfo(hFile, AviInfo, Len(AviInfo)) = 0 Then
            MsgBox "AVI dimensions: " + CStr(AviInfo.dwWidth) + "x" + CStr(AviInfo.dwHeight)
            MsgBox "Error while retrieving AVI information... :("
        End If
        'release the file handle
        AVIFileRelease hFile
        MsgBox "Error while opening the AVI file... :("
    End If
    'exit the AVIFile library and decrement the reference count for the library
End Sub

Here below is the code (that I made still for Visual Basic) I suggest you to use instead of any SendMessage call to BSplayer (note, the code may be defective, but to me works without problems):


Const SWP_DEFERERASE As Long = &H2000
Const SWP_HIDEWINDOW As Long = &H80
Const SWP_NOACTIVATE As Long = &H10
Const SWP_NOCOPYBITS As Long = &H100
Const SWP_NOMOVE As Long = &H2
Const SWP_NOREDRAW As Long = &H8
Const SWP_NOSIZE As Long = &H1
Const SWP_NOZORDER As Long = &H4
Const SWP_SHOWWINDOW As Long = &H40
Const HWND_BOTTOM As Long = 1
Const HWND_TOP As Long = 0
Const HWND_TOPMOST As Long = -1
Const HWND_NOTOPMOST As Long = -2

Private Declare Sub SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long,

ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)

Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Dim Rec As RECT
Dim ParentHwnd As Long
Dim AspectRatio As Single

'If you click on Button "Command1"
Private Sub Command1_Click()
    'Retrieve the handle of the MovieWindo
    ParentHwnd = FindWindow("TBSForm", "BForm")
    'If the MovieWindow exists
    If ParentHwnd <> 0 Then
        'Retrieve the MovieWindowSize
        GetWindowRect ParentHwnd, Rec
        'Calculate the AspectRatio of the current MovieWindow
        AspectRatio = Round((Rec.Right - Rec.Left) / (Rec.Bottom - Rec.Top), 3)
        'Resize the MovieWindow
        SetWindowPos ParentHwnd, HWND_TOPMOST, 0, 0, 800, Int(800 / AspectRatio), SWP_NOACTIVATE Or SWP_NOMOVE
        'Get the new MovieWindowSize
        GetWindowRect ParentHwnd, Rec
        'Display the current MovieWindowSize in the caption of the Button        "Command1"
        Command1.Caption = (Rec.Right - Rec.Left) & " x " & (Rec.Bottom - Rec.Top)
    End If
End Sub

This code resize the MovieWindow to have a width of 800pixels (as you asked in previous posts), and the height to the respective aspect-ratio height.
That means that if the movie window was 640x480, after the resizing it will be 800x600!
With this code the movie window will not be moved, if you want also to move the window, you have to delete the Or SWP_NOMOVE string from the SetWindowPos call!

I hope that finally this could help you :D

Tizio 22nd June 2005 07:54 PM

Since BSplayer build 818 comes out, MovieWindow name and class changed, so the code has to be modified as follow:

'If you click on Button "Command1"
Private Sub Command1_Click()
    'Retrieve the handle of the MovieWindo
    ParentHwnd = FindWindow("BSPVideoWindow", "VideoWindow")
    'If the MovieWindow exists
    If ParentHwnd <> 0 Then

All times are GMT +1. The time now is 09:17 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
Ad Management plugin by RedTyger

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20