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

    [RESOLVED] Strange stretching

    Strange behaviour of my application.
    In windows 7 - all work
    In windows xp after stretching main window - application close.
    Code of sizing:
    Code:
    	case WM_SIZE:
            SendMessage(hsb, WM_SIZE, 0, 0);
    		{RECT WindowRect;
            GetWindowRect(hwnd, &WindowRect);
    		int width = WindowRect.right-WindowRect.left;
    		SetWindowPos(hProgress, HWND_BOTTOM, 20, 150, width-50, 17, 0); 
    		break;}
    In what problem?

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: Strange stretching

    Why do you
    Code:
    SendMessage(hsb, WM_SIZE, 0, 0);
    from the "case WM_SIZE"?
    WM_SIZE is sent by the Windows in response to any action causing a window to be resized. You should not send it in your code. Instead you should call some API to resize a window (like MoveWindow or SetWindowPos)
    Victor Nijegorodov

  3. #3
    Join Date
    Feb 2012
    Posts
    181

    Re: Strange stretching

    Quote Originally Posted by VictorN View Post
    Why do you
    Code:
    SendMessage(hsb, WM_SIZE, 0, 0);
    from the "case WM_SIZE"?
    WM_SIZE is sent by the Windows in response to any action causing a window to be resized. You should not send it in your code. Instead you should call some API to resize a window (like MoveWindow or SetWindowPos)
    hsb - handle of status bar.
    I tried comment "SendMessage(hsb, WM_SIZE, 0, 0);" - it didn't help me.
    Last edited by AKE; October 18th, 2012 at 09:20 AM.

  4. #4
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: Strange stretching

    Quote Originally Posted by AKE View Post
    hsb - handle of status bar.
    It doesn't matter whether it is a status bar or any other window.

    Quote Originally Posted by AKE View Post
    I tried comment "SendMessage(hsb, WM_SIZE, 0, 0);" - it didn't help me.
    Well, this line must be removed because it is wrong. Either use MoveWindow or SetWindowPos or send some used defined message to the status bar window and implement its resizing while handling this message.

    Now define "application close". How exactly does it happen? Without any error message? without any message in the Windows Event Viewer?
    Victor Nijegorodov

  5. #5
    Join Date
    Feb 2012
    Posts
    181

    Re: Strange stretching

    VictorN,
    Without any message. Only disappear

  6. #6
    Join Date
    Feb 2012
    Posts
    181

    Re: Strange stretching

    What is Windows Event Viewer?

  7. #7
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: Strange stretching

    Victor Nijegorodov

  8. #8
    Join Date
    Feb 2012
    Posts
    181

    Re: Strange stretching

    Nothing in Windows Event Viewer
    Last edited by AKE; October 18th, 2012 at 09:51 AM.

  9. #9
    Join Date
    Feb 2012
    Posts
    181

    Re: Strange stretching

    WM_SIZING was without break

  10. #10
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: [RESOLVED] Strange stretching

    Well, you see now that posting only a small amount of code lines without showing what happened above and below these lines is often not enough. Don't you?
    Victor Nijegorodov

  11. #11
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Strange stretching

    Quote Originally Posted by AKE View Post
    Without any message. Only disappear
    In case you run it in VS IDE, and some abnormal termination happens, the Studio shows you some message regarding the immediate problem. In case it does not, your app closes because of natural reasons, which might mean that some of your code closes the main window or posts WM_QUIT message to main thread. You should find that by code review alright.
    Best regards,
    Igor

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