CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2012
    Posts
    6

    Corrupted Status Window Message

    When I repeatedly running the following code in VS10 debug mode, it behaves as I would expect. Right-clicking executes the expected code and the message in the status bar cycles correctly through the 2 cases. But when I run it as a release, the message is corrupted (I get a load of oriental characters). Making char* rcMess global doesn't help.

    The following is the extraxt from WinProc:

    switch (message)
    {
    case WM_RBUTTONDOWN:
    if (++parallel==3)
    parallel=0;
    //update status bar message
    char* rcMess;
    switch (parallel)
    {
    case 0:
    rcMess="Right-click for parallel 1 execution";
    break;
    case 1:
    rcMess="Right-click for parallel 2 execution";
    break;
    case 2:
    rcMess="Right-click for serial execution";
    break;
    }
    SendMessage(GetDlgItem(hWnd,IDC_STATUS),SB_SETTEXT,2,(LPARAM) (rcMess));
    InvalidateRect (hWnd,NULL,TRUE);
    UpdateWindow (hWnd);
    break;


    Any suggestions?

  2. #2
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: Corrupted Status Window Message

    Is UNICODE setting the same in your Debug and Release configurations?
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  3. #3
    Join Date
    Feb 2012
    Posts
    6

    Re: Corrupted Status Window Message

    Double education, thank you. Hadn't noted the different configuration between debug and release, and you queued me to look at the implication of Unicode. I also changed char* to wchar_t* which is more appropiate I think.

    Thanks for your guidance.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured