Shoutbox

Transparent background for RichEditControl - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Transparent background for RichEditControl (/showthread.php?tid=74658)

Transparent background for RichEditControl by pariah123 on 05-24-2007 at 02:55 PM

I'm trying to make a Text box that displays content (RSS).
I want the background of the text box to be transparent, there is a background image on the window.
I tried RichEdit and StaticControls but have no success...
There arent much options, Alpha, and BaseColor with transparency.
Any suggestions?


RE: Transparent background for RichEditControl by Ash_ on 05-28-2007 at 02:32 AM

i don't know how to do it with the Styles and stuff used for scripts but i think i remember how to do it with API.

heres the code in the best way i show you (sorry i havent made a script in ages dunno the calls to use the API)

code:
var GWL_EXSTYLE = -16
var WS_EX_TRANSPARENT = 0x20

var temp
temp = GetWindowLong(CtrlWnd, GWL_STYLE)
SetWindowLong(CtrlWnd, GWL_EXSTYLE, temp | WS_EX_TRANSPARENT)

(remember that CtrlWnd contains the handle of the RichTextBox not the entire window, im pretty sure your given the handle of the control when you create it (rtb = MsgPlus.CreateWnd(... or whatever it is))

hopefully that can solve your problem.

RE: RE: Transparent background for RichEditControl by Matti on 05-28-2007 at 07:18 AM

Well, GetWindowLong and SetWindowLong are Win32 API functions and are not built-in in JScript. Therefore, you'll need to call the libraries with Interop.Call. Also, the control handle can only be retrieved with PlusWnd.GetControlHandle. With these two things in mind, we end up with the following code:

code:
//PlusWnd is your created window with the RichEditControl
var GWL_EXSTYLE = -16
var WS_EX_TRANSPARENT = 0x20

var hWnd = PlusWnd.GetControlHandle("EdtThingy"); //Parameter is the Id of the RichEditcontrol
var Style = Interop.Call("user32", "GetWindowLong", hWnd, GWL_STYLE);
if(Style > 0) {
   Interop.Call("user32", "SetWindowLong", hWnd, GWL_STYLE, Style | WS_EX_TRANSPARENT);
} else {
   Debug.Trace("GetWindowLong returned an error. Return value: "+(Style.toString()));
}