mciSendString,将VB脚本移植到CE Lua脚本中。

问题描述 投票:0回答:1

我做了一个在面板边界内播放视频文件的项目(wo任何视频播放器应用),使用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

有什么解决办法吗?

vb.net cheat-engine mcisendstring
1个回答
0
投票

如果视频在面板边界内播放(比如面板1),那么忽略视频的长宽比,这里有一个函数可以将视频帧贴合到面板1上。

当视频开始播放时。

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

当改变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

同时问题解决了

© www.soinside.com 2019 - 2024. All rights reserved.