Positioning of window on Desktop
Hi All
I have a CFormView derived window which I would like to position at run time.
In particular when the user clicks a button I would like to shfit the CFormView window and open up a new Dialog window so that the two do not overlap.
I have created the CFormView window and the dialog window- can someone please tell me how to shfit the CFormView window?
I shift the Dialog window as follows in OnInitDialog:
SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
Thank you in advance.
AAEL
Re: Positioning of window on Desktop
Well, CFormView derived window is (like any other view) a child of a frame window (either mainframe or childframe)
You could also let more than one view share a frame window, as in the case of a splitter window. Perhaps, splitter is what you need?
Or what? Is your app an SDI or MDI?
Re: Positioning of window on Desktop
The application is an SDI.
All I would like to do is to have the two windows (the SDI CFormView window and the CDialog window) appear so that they do not overlap.
Thank you
Quote:
Originally Posted by
VictorN
Well, CFormView derived window is (like any other view) a child of a frame window (either mainframe or childframe)
You could also let more than one view share a frame window, as in the case of a splitter window. Perhaps, splitter is what you need?
Or what? Is your app an SDI or MDI?
Re: Positioning of window on Desktop
Then get the position of the view, then set the dialog position to be outside the view rect!
Re: Positioning of window on Desktop
How would I get the position of the view? What is the VC++ command to get the position of the view?
Thank you
Re: Positioning of window on Desktop
Re: Positioning of window on Desktop
The first parameter of GetWindowRect is HWND hWnd. How do I get the hWnd for my CFormView?
Thank you
Re: Positioning of window on Desktop
Quote:
Originally Posted by
aael
The first parameter of GetWindowRect is HWND hWnd. How do I get the hWnd for my CFormView?
Thank you
Try this one.
http://msdn.microsoft.com/en-us/libr.../f3ef9c0s.aspx
It's better to learn to use MSDN for basic stuff like this rather than using the forum in place of documentation.
Re: Positioning of window on Desktop
Thank you.
I managed to get the dimensions of the window.
Please can you tell me how to shift the CFormView window?
Re: Positioning of window on Desktop
Quote:
Originally Posted by
aael
Thank you.
I managed to get the dimensions of the window.
Please can you tell me how to shift the CFormView window?
Don't move the view, move the frame.
Re: Positioning of window on Desktop
Quote:
Originally Posted by
GCDEF
Don't move the view, move the frame.
Don't move the frame either - just position your new dialog do it doesn't overlap your view.
I would be upset if I clicked the button on a form and that form got moved :)