使用Lua脚本禁用桌面合成 [英] Disabling Desktop Composition using Lua Scripting

查看:183
本文介绍了使用Lua脚本禁用桌面合成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用IndigoRose的Set-Up Factory来构建我的安装程序.设置工厂在安装程序的脚本部分使用lua语言.现在,对于我的应用程序,安装完成后,如果操作系统是Windows 7,我想运行一个禁用桌面分解的脚本.是否可以通过lua访问dwmapi.lib来执行此操作. 是否有系统库功能可访问桌面窗口管理器?

Im using Set-Up Factory from IndigoRose for building my installers. Set-up factory uses lua language in the scripting section of the installers. Now, for my application once the installing is done, I would like to run a script which disables desktop decomposition if the operating system is windows 7. Is there a way I can access dwmapi.lib in lua for doing it. Is there a system library function to access desktop window manager?

我已经进行了一些谷歌搜索,并找到了vbscript的以下代码.

I have done some googling and found out the following code for vbscript..

Private Const DWM_EC_DISABLECOMPOSITION As Long = 0
Private Const DWM_EC_ENABLECOMPOSITION As Long = 1

Private Declare Function DwmEnableComposition Lib "dwmapi" (uCompositionAction As Long) As Long

Private Function SUCCEEDED(hr As Long) As Boolean
    SUCCEEDED = (hr >= 0)
End Function
Private Function FAILED(hr As Long) As Boolean
    FAILED = (hr < 0)
End Function

Private Sub Form_Load()
    If SUCCEEDED(DwmEnableComposition(DWM_EC_DISABLECOMPOSITION)) Then
        MsgBox "Vista Aero est Desactive"
    Else
        MsgBox "Vista Aero n'a pas pu etre Desactive"
    End If

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    MsgBox Cancel
    MsgBox UnloadMode
    If SUCCEEDED(DwmEnableComposition(DWM_EC_ENABLECOMPOSITION)) Then
        MsgBox "Vista Aero est Active"
    Else
        MsgBox "Vista Aero n'a pas pu etre active"
    End If

End Sub 

我如何在LUA中做到这一点?

How can I do this in LUA??

推荐答案

由于您没有头文件,并且直接希望从Lua的DLL(dwmapi.dll)中访问函数,因此您必须尝试使用外部功能接口"库在那里.查看Lua Wiki上的"C外部函数接口" 部分,以获取到Alien的链接(包装libffi ),LuaJIT FFI(如果要使用LuaJIT)和C/调用Lua.

Since you don't have header files and you directly want to access functions from a DLL (dwmapi.dll) from Lua, you would have to try on of the "foreign function interface" libraries out there. Look at the section "C Foreign Function Interfaces" on the Lua Wiki for links to Alien (wraps libffi), LuaJIT FFI (if you want to use LuaJIT), and C/Invoke Lua.

这篇关于使用Lua脚本禁用桌面合成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆