Click here to Skip to main content
16,019,273 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Windows Service Pin
Joan M5-Mar-08 7:19
professionalJoan M5-Mar-08 7:19 
GeneralRe: Windows Service Pin
Mark Salsbery5-Mar-08 11:53
Mark Salsbery5-Mar-08 11:53 
GeneralRe: Windows Service Pin
Randor 5-Mar-08 8:13
professional Randor 5-Mar-08 8:13 
QuestionSelf-registered edit control class crashes because of wrong GetWindowTextLength return value Pin
Skarrin5-Mar-08 6:50
Skarrin5-Mar-08 6:50 
QuestionRe: Self-registered edit control class crashes because of wrong GetWindowTextLength return value Pin
CPallini5-Mar-08 8:27
mveCPallini5-Mar-08 8:27 
GeneralRe: Self-registered edit control class crashes because of wrong GetWindowTextLength return value Pin
Skarrin5-Mar-08 21:28
Skarrin5-Mar-08 21:28 
GeneralRe: Self-registered edit control class crashes because of wrong GetWindowTextLength return value Pin
Randor 5-Mar-08 8:56
professional Randor 5-Mar-08 8:56 
GeneralRe: Self-registered edit control class crashes because of wrong GetWindowTextLength return value Pin
Skarrin5-Mar-08 21:52
Skarrin5-Mar-08 21:52 
The control does not use unicode, I have checked that. As I wrote, the problem only occurs if I enable XP visual styles and themes for the application by including a manifest file in the executables directory.

I already tried to write replacements for Get/SetWindowText:
void CGXEditControl::GetWindowText(CString& s)<br />
{<br />
	if (IsThemeActive())<br />
	{<br />
		const int nLen = ::GetWindowTextLengthW(m_hWnd);<br />
		CStringW sW;<br />
		::GetWindowTextW(m_hWnd, sW.GetBufferSetLength(nLen), nLen+1);<br />
		sW.ReleaseBuffer();<br />
<br />
		s = sW;<br />
	}<br />
	else<br />
	{<br />
//CGXEditControl is derived from CEdit, CGXStatic<br />
		CEdit::GetWindowText(s);<br />
	}<br />
}<br />
<br />
void CGXEditControl::SetWindowText(const CString& s)<br />
{<br />
	if (IsThemeActive())<br />
	{<br />
		CStringW sW(s);<br />
		::SetWindowTextW(GetSafeHwnd(), sW);<br />
	}<br />
	else<br />
	{<br />
		CEdit::SetWindowText(s);<br />
	}<br />
}

This prevents the heap corruption, but then the edit control contains a lot of unreadable stuff like arabic letters OMG | :OMG: even though the debugger shows that sW seems to contain a correct string like "1120".

The problem seems to be the registration process of the class GXEDIT.
In CGXEditControl::CreateControl, if I replace the class name "GXEDIT" with the standard "edit" class in the call to CEdit::Create, everything works!
But I don't know what side effects this will have for the rest of the library Confused | :confused: , so I want to avoid this workaround if possible.

BTW, this library is a very antique version of Stingray's Objective Grid, dated 1997 Blush | :O .

Regards, Jens
QuestionHow to display animated gif on status bar Pin
ptr_Electron5-Mar-08 4:56
ptr_Electron5-Mar-08 4:56 
AnswerRe: How to display animated gif on status bar Pin
toxcct5-Mar-08 5:04
toxcct5-Mar-08 5:04 
GeneralRe: How to display animated gif on status bar Pin
ptr_Electron6-Mar-08 0:41
ptr_Electron6-Mar-08 0:41 
AnswerRe: How to display animated gif on status bar Pin
Mark Salsbery5-Mar-08 14:31
Mark Salsbery5-Mar-08 14:31 
GeneralGetting Thread Exit Code Pin
masnu5-Mar-08 4:23
masnu5-Mar-08 4:23 
GeneralRe: Getting Thread Exit Code Pin
led mike5-Mar-08 4:30
led mike5-Mar-08 4:30 
GeneralRe: Getting Thread Exit Code Pin
masnu5-Mar-08 4:33
masnu5-Mar-08 4:33 
GeneralRe: Getting Thread Exit Code Pin
Ernest Laurentin5-Mar-08 4:41
Ernest Laurentin5-Mar-08 4:41 
GeneralRe: Getting Thread Exit Code Pin
CPallini5-Mar-08 4:48
mveCPallini5-Mar-08 4:48 
GeneralRe: Getting Thread Exit Code Pin
led mike5-Mar-08 5:29
led mike5-Mar-08 5:29 
GeneralRe: Getting Thread Exit Code Pin
Mark Salsbery5-Mar-08 14:32
Mark Salsbery5-Mar-08 14:32 
Questionhow to watch the content which is pointed by a pointer Pin
wendyyue5-Mar-08 3:50
wendyyue5-Mar-08 3:50 
AnswerRe: how to watch the content which is pointed by a pointer Pin
toxcct5-Mar-08 4:15
toxcct5-Mar-08 4:15 
GeneralRe: how to watch the content which is pointed by a pointer Pin
Rajkumar R5-Mar-08 4:59
Rajkumar R5-Mar-08 4:59 
GeneralRe: how to watch the content which is pointed by a pointer Pin
toxcct5-Mar-08 5:01
toxcct5-Mar-08 5:01 
GeneralRe: how to watch the content which is pointed by a pointer Pin
Rajkumar R5-Mar-08 5:12
Rajkumar R5-Mar-08 5:12 
AnswerRe: how to watch the content which is pointed by a pointer Pin
Ernest Laurentin5-Mar-08 4:44
Ernest Laurentin5-Mar-08 4:44 

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.