Rank: Advanced Member
Groups: Translators, Moderators, Approved Joined: 4/6/2020(UTC) Posts: 79 Thanks: 1 times Was thanked: 21 time(s) in 21 post(s)
|
Read this first. Then add this after that. Code:var WindowAlpha = (function(){
var RtnT = clr.System.Type.GetType("System.Boolean");
GLWA = MethodFromNativeDll("user32.dll", "GetLayeredWindowAttributes", RtnT,
GetParmT(["System.IntPtr", "System.Int32&", "System.Byte&", "System.Int32&"]));
SLWA = MethodFromNativeDll("user32.dll", "SetLayeredWindowAttributes", RtnT,
GetParmT(["System.IntPtr", "System.Int32", "System.Byte", "System.Int32"]));
return {Get : function GetAlpha(hwnd) {
var a = GetParm([action.Window.HWnd, 0, host.newVar(clr.System.Byte), 0]);
GLWA.Invoke(null, a);
return a[2];
},
Set : function SetAlpha(hwnd, alpha) {
return SLWA.Invoke(null, GetParm([hwnd, 0, host.newVar(clr.System.Byte, alpha), 2]));
}};
})();
Example: Code:// Set window to layered, or it can't be transparent.
action.Window.ExtendedStyle = clr.System.Enum.Parse(
action.Window.ExtendedStyle.GetType(),
action.Window.ExtendedStyle.ToString() + ', LAYERED'
)
if (WindowAlpha['Get'](action.Window.HWnd) == 128) {
WindowAlpha['Set'](action.Window.HWnd, 255);
} else {
WindowAlpha['Set'](action.Window.HWnd, 128);
}
|
1 user thanked liuxilu for this useful post.
|
|