Click here to Skip to main content
15,906,816 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: WTL Menu problem Pin
damir_tk13-Jan-08 14:09
damir_tk13-Jan-08 14:09 
QuestionHow to access member functions of coclass from its Interface Pin
mandanani8-Jan-08 16:51
mandanani8-Jan-08 16:51 
AnswerRe: How to access member functions of coclass from its Interface Pin
mandanani8-Jan-08 20:41
mandanani8-Jan-08 20:41 
GeneralRe: How to access member functions of coclass from its Interface Pin
Nathan Holt at EMOM9-Jan-08 10:02
Nathan Holt at EMOM9-Jan-08 10:02 
GeneralCOM object and global pointers [modified] Pin
Monty27-Jan-08 21:54
Monty27-Jan-08 21:54 
GeneralRe: COM object and global pointers Pin
led mike8-Jan-08 5:04
led mike8-Jan-08 5:04 
GeneralOleDb, IRowsetIndex Pin
ArielR7-Jan-08 3:38
ArielR7-Jan-08 3:38 
GeneralStatic controls transparency problem Pin
mirano6-Jan-08 10:19
mirano6-Jan-08 10:19 
Hi,

I have a problem with getting a transparent static control to draw correctly on a WTL dialog. Everything I do works, but only if the text color is black.

Message handler is like this:

<small>MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnCtlColorStatic)</small>

Then I have a method to handle it:
<br />
<small>LRESULT OnCtlColorStatic(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);</small>


and in the code I do like this:

<small>LRESULT MainDialog::OnCtlColorStatic(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)<br />
{<br />
	HWND hWnd = (HWND)lParam;<br />
	HDC hDc = (HDC)wParam;<br />
<br />
	COLORREF m_crTextColorMaroon;<br />
	m_crTextColorMaroon = RGB( 128, 0, 0 );<br />
	HBRUSH hbr;<br />
	hbr = (HBRUSH)m_crTextColorMaroon;<br />
<br />
	if( hWnd == (HWND)GetDlgItem(IDC_FILE) ||<br />
		hWnd == (HWND)GetDlgItem(IDC_FILESIZE)) 	<br />
	{<br />
		::SetTextColor( hDc, m_crTextColorMaroon );<br />
		::SetBkMode(hDc, TRANSPARENT);<br />
		return (LRESULT) GetStockObject (HOLLOW_BRUSH);<br />
	}<br />
<br />
	return 0;<br />
}</small>


So far so good, everything works. I am only changing the color of the controls that will represent a label, the other static controls on the dialog should display text in the black color. So this works perfectly when the dialog gets displayed.

Now the user changes the language on the menu, and I do this:

<small>SetDlgItemText( IDC_FILE, (LPCTSTR) SomeNewText);</small>

and the text gets drawn over the previous text, making it indecipherable.

What is wrong with this code? Why doesn't the static controls clear its content before the new text is drawn.
If I use <small>SetDlgItemText(...)</small> with any other static control that is not handled in the <small>OnCtlColorStatic</small> method, it gets drawn correctly.

Thanks for your help.

Sarajevo, Bosnia

GeneralRe: Static controls transparency problem Pin
Michael Dunn6-Jan-08 11:05
sitebuilderMichael Dunn6-Jan-08 11:05 
GeneralRe: Static controls transparency problem Pin
mirano6-Jan-08 11:52
mirano6-Jan-08 11:52 
GeneralRe: Static controls transparency problem [modified] Pin
Michael Dunn6-Jan-08 12:09
sitebuilderMichael Dunn6-Jan-08 12:09 
GeneralRe: Static controls transparency problem Pin
mirano7-Jan-08 0:34
mirano7-Jan-08 0:34 
GeneralMSMQ Pin
shakumar_221-Jan-08 22:27
shakumar_221-Jan-08 22:27 
QuestionCInternetSession Assertion Failure Pin
İsmail Durmaz22-Dec-07 7:30
İsmail Durmaz22-Dec-07 7:30 
GeneralNamespace ATL Pin
Ju@ncho19-Dec-07 7:00
Ju@ncho19-Dec-07 7:00 
GeneralNeed to launch outlook Pin
SamuelHenderson18-Dec-07 5:37
SamuelHenderson18-Dec-07 5:37 
QuestionWhere did the WTL documentation project go? Pin
Perceptor18-Dec-07 3:33
Perceptor18-Dec-07 3:33 
GeneralA strange WTL-app debug/release problem [modified] Pin
T800G14-Dec-07 15:06
T800G14-Dec-07 15:06 
GeneralRe: A strange WTL-app debug/release problem Pin
CPallini28-Dec-07 11:45
mveCPallini28-Dec-07 11:45 
QuestionWTL COM? Pin
Kuryn13-Dec-07 23:17
Kuryn13-Dec-07 23:17 
AnswerRe: WTL COM? Pin
George L. Jackson14-Dec-07 4:44
George L. Jackson14-Dec-07 4:44 
GeneralRe: WTL COM? Pin
Kuryn15-Dec-07 18:12
Kuryn15-Dec-07 18:12 
GeneralRe: WTL COM? Pin
George L. Jackson16-Dec-07 14:23
George L. Jackson16-Dec-07 14:23 
AnswerRe: WTL COM? Pin
led mike18-Dec-07 5:29
led mike18-Dec-07 5:29 
AnswerRe: WTL COM? Pin
Michael Dunn5-Jan-08 20:36
sitebuilderMichael Dunn5-Jan-08 20:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.