I'm not a huge fan of MFC but have used it extensively in the past. I never had trouble mixing Win32 and MFC at all, in fact I found doing so essential and just part of a regular day MFCing.
Steve
I'm not a huge fan of MFC but have used it extensively in the past. I never had trouble mixing Win32 and MFC at all, in fact I found doing so essential and just part of a regular day MFCing.
Steve
I'd use spy and verify the window hierarchy is as you expect. Perhaps the dialog is not a direct parent of the slider.
Steve
That's more like ON ERROR BAIL.
Steve
Perhaps it won't, but I will. I'm ditching Windows after MS's nonsense.
Steve
You are reading correctly, I just spelt "no" wrong. And it's an easy word too.
Steve
When a thread waits on an event it isn't scheduled and so consumes so no CPU time. Waiting on a global variable requires polling and so does.
Steve
That seems likely.
Steve
Reading the word under the cursor via UI Automation[^] This example is in C# but you should be able to make a C++ version easily enough.
Steve
What doesn't work? compiler error? What's the error? Runtime error? Describe it. Give people something to go on!
Steve
In general I would suggest you don't use it, having to tends to suggest you have some badly designed code. Prefer inheritance and virtual functions.
Steve
In general it may indeed be better to create it on the stack. The reason you'd use new
is when you want more control over it's lifetime. For example you can't use the stack if it need to stay "alive" after the function returns (more generally, when it goes out of scope).
Steve
Post some code. Not reams of code if you expect an answer, a minimal program that shows your problem. I concede that at times this is easier said than done.
Steve
This is probably where the buffer overrun was detected, not where it actually occurred. In general it is not possible (or prohibitively expensive) to detect the actual corruption. Try using the Page Heap[^], although this often falls in the prohibitively expensive category. Remember to disable it when you're done! WARNING: DO NOT ENABLE THE PAGE HEAP FOR ALL PROCESSES, JUST THE ONE YOU'RE DEBUGGING. YOU HAVE BEEN WARNED!
Steve
Whenever you get a crash provide:
This is the bare minimum. I also like the some dissassembly around:
I suggest you post as much of this as you can manage.
Steve
ForNow wrote:
(LPCTSTR)"SockClientThreadFail"
ForNow wrote:
(LPCTSTR)"192.168.1.4"
This is probably not the answer you're looking for, but it's more important. What the hell are you catting to LPCTSTR
for? This is at best pointless and at worst a runtime error that would be a compile time one without the cast. You can cast all you like but it will not make it walk like a duck. If your compiling for ANSI then the cast does nothing except look stupid. If your compiling for UNICODE you're effectively telling to compiler to shut up and not issue an error (and you've made one) and just pretend that the ANSI string is a UNICODE one. Best case is a garbled string, worst a buffer overrun. Use the _T
macro from <tchar.h>
.
Steve
The error message tells you exactly how to fix the problem...
Steve
ForNow wrote:
m_pMainWnd->MessageBox((LPCTSTR)"SockClientThreadFail",NULL,MB_ICONERROR);
Look at the underlined section. What are you hoping to achieve by the cast? If you're compiling for non-Unicode it does nothing and if it's a Unicode build it tells the compiler not to issue an error but to shut up and assume the ANSI string is a Unicode one, which it's clearly not. Best case scenario is a garbled string in the message box, worst case an access violation because of no double NULL terminator. This is the typical fate of the cast-happy: turning a compile-time error into a runtime one. Don't cast if you don't know what's going on or fumble around casting to suppress a compiler error. You don't need any casts:
m_pMainWnd->MessageBox(_T("SockClientThreadFail"), NULL, MB_ICONERROR);
Steve
Give calling SetCursorPos[/\] a try.
Steve
Post a stack trace after the problem has occurred.
Steve