0

I made a project that plays a video file inside a panel boundary (w/o any video player apps), using Cheat Engine Lua script + mciSendString winmm.dll, it's work fine. The problem is I want to fit video size to panel size. I have this part of VB script:

Public Function getDefaultSize() As Size
        'Returns the default width, height the movie
        Dim c_Data As String = Space(128)
        mciSendString("where movie source", c_Data, 128, 0)
        Dim parts() As String = Split(c_Data, " ")

        Return New Size(CInt(parts(2)), CInt(parts(3)))
    End Function

and I want ported that script to CE Lua, so far:

function getDefaultSize(Size)
  local c_Data = string.rep(" ",128)  -- Space(128)
  mciSendString("where movie source", c_Data, 128, 0)

--- this part need adapting to Lua
--  Dim parts() = Split(c_Data, " ") --string
--  return  New Size(CInt(parts(2)), CInt(parts(3)))

end

Any solutions?

JoeFern
  • 117
  • 1
  • 8

1 Answers1

0

In case the video playing inside a panel boundary (say as panel1) then by ignoring the video aspect ratio, here is the function to fit the video frame to the panel1.

When video start playing:

 iLeft = 0
 iTop = 0
 newWidth = panel1.Width
 newHeight = panel1.Height
 mciSendString("put movie window at "..iLeft.." "..iTop.." "..newWidth.." "..newHeight, "", 0, 0)

When change bound of form / panel1:

function panel1_sizeChange()
 if playing then
    --SizeVideoWindow(panel1.getSize())
    iLeft = 0
    iTop = 0
    newWidth = panel1.Width
    newHeight = panel1.Height
    mciSendString("put movie window at "..iLeft.." "..iTop.." "..newWidth.." "..newHeight, "", 0, 0)
 end
end

Meanwhile the problem solved

JoeFern
  • 117
  • 1
  • 8