我想双击对话框的标题栏,把对话框放到固定的位置,是不是用SetWindowPos,但是如何来做呢?各个参数是什么意思,如何得到?

解决方案 »

  1.   

    你用MOVEWINDOW就可以了BOOL MoveWindow(
      HWND hWnd,      // handle to window
      int X,          // horizontal position
      int Y,          // vertical position
      int nWidth,     // width
      int nHeight,    // height
      BOOL bRepaint   // repaint option
    );或者用CWnd的方法:
    CWnd::MoveWindow
    void MoveWindow( int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE );void MoveWindow( LPCRECT lpRect, BOOL bRepaint = TRUE );
    SetWindowPos是设置把窗口总放在最前面的。GF
      

  2.   

    响应标题栏的双击事件,加入代码
          SetWindowPos(HWND_TOP, 
                x,             //left
                y,            //top
                0, 0,          // ignores size arguments 
                SWP_NOSIZE); 
      

  3.   

    SetWindowPos (NULL, 100 , 100 , 0 , 0 , SWP_NOSIZE |SWP_NOZORDER) ;
      

  4.   

    是用SetWindowPos
    MoveWindow()不但改变位置,而且改变大小
      

  5.   

    请问如何判断是否为标题栏接受的消息?  用SDK
      

  6.   

    yes!:)
    use WM_NCLBUTTONDBLCLK messgae,if the message's WPARAM value equals HTCAPTION,
    indicate dblclick the title bar,then use SetWindowPos。
      

  7.   

    CXxDlg m;
    CRect jj;
    m.getWindowRect(&jj);
    CPoint tt;
    m.MoveWindow(tt.x,tt.y,jj.left,jj.top);
      

  8.   

    错了,是movewindow(tt.x,tt.y,jj.height,jj.width)