Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. void CTopDlgDemoDlg::StayOnTop() const
  2. {
  3. CRect rect;
  4.  
  5. // get the current window size and position
  6. GetWindowRect( rect );
  7.  
  8. // now change the size, position, and Z order
  9. // of the window.
  10. ::SetWindowPos(m_hWnd , // handle to window
  11. HWND_TOPMOST, // placement-order handle
  12. rect.left, // horizontal position
  13. rect.top, // vertical position
  14. rect.Width(), // width
  15. rect.Height(), // height
  16. SWP_SHOWWINDOW // window-positioning options);
  17. }
  18.  
  19. // add a control button and command handler for the button to your dialog.
  20. // then invoke StayOnTop().
  21. void CTopDlgDemoDlg::OnBtnClick()
  22. {
  23. // make this dialog always on top.
  24. StayOnTop();
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement