【问题标题】:mciSendString, ported VB Script to CE Lua scriptmciSendString,将 VB 脚本移植到 CE Lua 脚本
【发布时间】:2020-04-23 07:26:47
【问题描述】:

我使用 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】:

    如果视频在面板边界(例如 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-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-01
      • 2021-01-11
      相关资源
      最近更新 更多