CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: Technology of moving window

    Quote Originally Posted by Hobson
    And I am really pissed when some app ignores my settings and behaves other way (vide Winamp). Probably developers think that their app looks sooo coooool that it should be visible all the time. I wonder when they will start to set 'Always on top' style.
    Fully agree! :yellow handshoe:

  2. #17

    Re: Technology of moving window

    Originally Posted by zerver
    This is an OS setting: Display properties --> Effects --> "Show window contents while dragging".
    Originally Posted by Hobson
    I.e. Winamp draws whole window when dragging. This can be done in a few ways I guess, the one I found out is to create WM_MOVING message handler in following way:
    if you cancel the effect of "Show window contents while dragging", you will find that when you are dragging the window the WM_MOVING does not happen only the LMB is upped

  3. #18

    Re: Technology of moving window

    i have an another question now.
    why the function of IsWindowVisible always return zero?
    That is a dialog create by MFC AppWizard
    what should i do

  4. #19
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: Technology of moving window

    Quote Originally Posted by blacksource
    why the function of IsWindowVisible always return zero?
    How can we know, without seeing your code? Perhaps because that window is invisible?

    Quote Originally Posted by blacksource
    That is a dialog create by MFC AppWizard
    Hm... Sounds suspiciously like the modal main dialog of a "dialog-based" project... So where are you calling IsWindowVisible()?

  5. #20

    Re: Technology of moving window

    i call the function on CDockWndDlg::OnMove(int x, int y)

  6. #21
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: Technology of moving window

    Quote Originally Posted by blacksource
    i call the function on CDockWndDlg::OnMove(int x, int y)
    Hm... and that's all your code? I don't see any IsWindowVisible() call there.

  7. #22

    Re: Technology of moving window

    sorry, i call the function here
    Code:
     
    void CDockWndDlg::OnMove(int x, int y) 
    {
    CDialog::OnMove(x, y);
     
    // TODO: Add your message handler code here
    RECT rect, rectMain;
     
    // Get the rectangle of Docking Window
    rect = (RECT)m_dlgDock.GetRect();
     
    // Get the rectangle of Main Window
    GetWindowRect( &rectMain );
     
    // If Main Window is visible....beginning Docking
    if( IsWindowVisible() )
    {
     
    	// Check the station of docking
    	if( m_dlgDock.m_bDocked )
    	{
    		CRect rect;
     
    	 // remember the rectangle position of Docking Window
    	 rect = m_dlgDock.GetRect();
     
    	 rect.OffsetRect(m_rectMain.left - x, m_rectMain.top - y ); 
     
    	 // Move the Docking Window to Main Window
    	 // m_dlgDock.MoveWindow( &rect );
    	}
    }
    GetWindowRect( &m_rectMain );
     
    }
    if i call m_dlgDock.MoveWindow( &rect ) direct without checking there will be an error when the initial of dialog

  8. #23
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: Technology of moving window

    Quote Originally Posted by blacksource
    if i call m_dlgDock.MoveWindow( &rect ) direct without checking there will be an error when the initial of dialog
    Okay, now I see what you are trying to do. The problem is that your OnMove() handler will be called once at the beginning during the window creation process - at that time, the window won't be created yet, and most of those calls will fail.

    The correct way to handle this is not to test whether the window is visible, but whether it has a valid HWND attached to it - this is best done by testing m_hWnd against NULL.

  9. #24

    Re: Technology of moving window

    yeah.....
    thanks gstercken

Page 2 of 2 FirstFirst 12

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