0

我制作了一个在面板边界内播放视频文件的项目(没有任何视频播放器应用程序),使用 Cheat Engine Lua 脚本 + mciSendString winmm.dll,它工作正常。问题是我想使视频尺寸适合面板尺寸。我有这部分 VB 脚本:

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

到目前为止,我想将该脚本移植到 CE Lua:

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

有什么解决办法吗?

4

1 回答 1

0

如果视频在面板边界(例如 panel1)内播放,则忽略视频纵横比,这是使视频帧适合 panel1 的功能。

当视频开始播放时:

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

当更改表单/面板1的边界时:

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

同时问题解决了

于 2020-04-23T12:58:38.870 回答