Click here to Skip to main content
15,885,757 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Knowing if the Application is already beeing executed (Previnstance) Pin
Joan M5-Mar-08 7:59
professionalJoan M5-Mar-08 7:59 
GeneralRe: Knowing if the Application is already beeing executed (Previnstance) Pin
CPallini5-Mar-08 8:04
mveCPallini5-Mar-08 8:04 
AnswerRe: Knowing if the Application is already beeing executed (Previnstance) Pin
Roger Stoltz5-Mar-08 21:12
Roger Stoltz5-Mar-08 21:12 
GeneralWindows Service Pin
act_x5-Mar-08 6:59
act_x5-Mar-08 6:59 
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 
Hello,

long title, short story: a rather old third-party library uses the following code to register its own edit control class:

static const TCHAR BASED_CODE szEdit[] = _T("GXEDIT");<br />
WNDCLASS wcls;<br />
// check to see if class already registered<br />
	if (!::GetClassInfo(hResource, szEdit, &wcls))<br />
	{<br />
		// Use standard "edit" control as a template.<br />
		VERIFY(::GetClassInfo(NULL, _T("edit"), &wcls));<br />
<br />
		// set new values<br />
		wcls.style |= GX_GLOBALCLASS;<br />
		wcls.hInstance = hResource;<br />
		wcls.lpszClassName = szEdit;<br />
<br />
		AfxRegisterClass(&wcls);


This works fine unless XP themes are enabled.
If they are and I use GetWindowText(CString-variable) with this edit control, the CString destructor causes a heap corruption because ::GetWindowTextLength reports less bytes than ::GetWindowText actually receives, and thus CString::GetBufferSetLength allocates not enough memory.

Is there a simple solution to change the above code so that this GXEDIT works with XP themes?
I already tried rewriting it using WNDCLASSEX instead, but that didn't help.

adTHANKSvance, Jens
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 
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 

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.