Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Making a RichEdit see through.

24 views
Skip to first unread message

Allan Bruce

unread,
Jun 7, 2004, 8:38:10 AM6/7/04
to
I want to make a RichEdit control see through. I was going to use a layered
window and use SetLayeredWindowAttributes to change the alpha, but child
windows do not support the WS_EX_LAYERED extended style. I am creating a
chat program, which just has a status bar, a tool bar, and 2 Rich Edit
windows. I want a background picture to be visible behind both RichEdits.
At the moment, I have the 2 RichEdit windows transparent, and I draw the
background with a manually lightened rectangle for each RichEdit to give the
illusion that they are semi-opaque, but I have run into problems this way.
Is there any way someone has achieved this? I am not using MFC/ATL.
Thanks
Allan


Christian ASTOR

unread,
Jun 7, 2004, 2:14:00 PM6/7/04
to
Allan Bruce a écrit:

> I want to make a RichEdit control see through.

WS_EX_TRANSPARENT (v. >= 2.0 ("RichEd20.Dll", RICHEDIT_CLASS))
+ subclassing (WM_CHAR (InvalidateRect()) + WM_ERASEBKGND to
remove flickering)

Allan Bruce

unread,
Jun 7, 2004, 2:40:27 PM6/7/04
to

"Christian ASTOR" <cast...@club-internet.fr> wrote in message
news:OjXc0uL...@TK2MSFTNGP11.phx.gbl...

This sounds good, but how does one subclass? I may already be doing this
but call it something different?
Thanks
Allan

Christian ASTOR

unread,
Jun 8, 2004, 2:29:13 AM6/8/04
to
Allan Bruce a écrit:

> This sounds good, but how does one subclass?


LRESULT OldEditProc;
LRESULT CALLBACK EditProc( HWND, UINT, WPARAM, LPARAM );

OldEditProc = SetWindowLong(hEdit,GWL_WNDPROC,(LONG) (WNDPROC) EditProc);

LRESULT CALLBACK EditProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
lParam)
{
switch (uMsg)
{
case WM_CHAR:
{
RECT rect;
GetClientRect(hWnd, &rect);
ClientToScreen(hWnd, (LPPOINT)&rect);
ScreenToClient(GetParent(hWnd),(LPPOINT) &rect);
InvalidateRect(GetParent(hWnd), &rect, TRUE);
}
break;
///case ...
}
return(CallWindowProc((WNDPROC)OldEditProc, hWnd, uMsg, wParam, lParam ));
}

Allan Bruce

unread,
Jun 8, 2004, 12:00:26 PM6/8/04
to

"Christian ASTOR" <cast...@club-internet.fr> wrote in message
news:Ox0ekKST...@TK2MSFTNGP11.phx.gbl...

merci beaucoup, c'est parfait!
Allan


0 new messages