Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

Stephen Hewitt

@Stephen Hewitt
About
Posts
4.2k
Topics
39
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Owner Draw Static Control Freezes up application
    S Stephen Hewitt

    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

    C / C++ / MFC

  • Custom Slider control messages cannot be caught
    S Stephen Hewitt

    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

    C / C++ / MFC

  • ON ERROR RESUME NEXT
    S Stephen Hewitt

    That's more like ON ERROR BAIL.

    Steve

    The Lounge

  • KB3035583
    S Stephen Hewitt

    Perhaps it won't, but I will. I'm ditching Windows after MS's nonsense.

    Steve

    The Lounge

  • Event objects VS Global variables
    S Stephen Hewitt

    You are reading correctly, I just spelt "no" wrong. And it's an easy word too.

    Steve

    C / C++ / MFC

  • Event objects VS Global variables
    S Stephen Hewitt

    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

    C / C++ / MFC

  • MFC: flickering issue with GDI+
    S Stephen Hewitt

    That seems likely.

    Steve

    C / C++ / MFC

  • IAccessible - get word under mouse pointer in IE
    S Stephen Hewitt

    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

    C / C++ / MFC

  • How to correctly pass a LPCSTR type parameter to a thread in DLL?
    S Stephen Hewitt

    What doesn't work? compiler error? What's the error? Runtime error? Describe it. Give people something to go on!

    Steve

    C / C++ / MFC

  • Please help me. Where to use <dynamic_cast> in c++ with example?
    S Stephen Hewitt

    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

    C / C++ / MFC

  • what's the point of auto_ptr & unique_ptr?
    S Stephen Hewitt

    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

    C / C++ / MFC

  • SetWindowsHookEx
    S Stephen Hewitt

    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

    C / C++ / MFC

  • Buffer overrun at _CRT_DEBUGGER_HOOK in dbghook.c (using log4cxx)
    S Stephen Hewitt

    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

    C / C++ / MFC

  • Streaming Image File from MFC app to HTML Page
    S Stephen Hewitt

    If it's a file on the HD simply use an image tag with a file URL[^].

    Steve

    C / C++ / MFC

  • WaitForSingleObject Crash
    S Stephen Hewitt

    Whenever you get a crash provide:

    1. The exception info
    2. The source around the problem with the line highlighted
    3. The values of any variables of interest (used in the crashing line)
    4. A stack trace

    This is the bare minimum. I also like the some dissassembly around:

    1. The crash site
    2. The last transition from your code.

    I suggest you post as much of this as you can manage.

    Steve

    C / C++ / MFC

  • WaitForSingleObject Crash
    S Stephen Hewitt

    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

    C / C++ / MFC

  • QT C1128: number of sections exceeded object file format limit : compile with /bigobj
    S Stephen Hewitt

    The error message tells you exactly how to fix the problem...

    Steve

    C / C++ / MFC

  • Access Violation CwinThread::CreateThread
    S Stephen Hewitt

    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

    C / C++ / MFC

  • [C++] How to change the mouse position in Mouse Hook
    S Stephen Hewitt

    Give calling SetCursorPos[/\] a try.

    Steve

    C / C++ / MFC

  • Threads and messages - is this legal?
    S Stephen Hewitt

    Post a stack trace after the problem has occurred.

    Steve

    C / C++ / MFC
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups