MoveWindow()
-
I am trying to resize my application based on the size of a loaded file. First I tried to use SetWindowPos() this worked, but did not resize the frame. So I have attempted to use MoveWindow() to do this, and it works.. but not as expected. For example if somebody could review this code fragment and tell me whats up. The file I am loading is a video, and lets say the size is 320 x 480 the frame resizes to a really tiny window. CRect winRect; CRect tmpRect; GetClientRect(tmpRect); if(!m_media.GetVidSize(winRect)) DoError("Unable to receive size"); GetParentFrame()->MoveWindow(tmpRect.Width(),tmpRect.Height(),winRect.Width(), winRect.Height()); CString str; str.Format("Video Width: %d\nVideo Height: %d\n", winRect.Width(), winRect.Height()); TRACE(str); I can verify that GetVidSize() is returning correct results based upon the TRACE statment wich outputs 320 and 480. Thank you
-
I am trying to resize my application based on the size of a loaded file. First I tried to use SetWindowPos() this worked, but did not resize the frame. So I have attempted to use MoveWindow() to do this, and it works.. but not as expected. For example if somebody could review this code fragment and tell me whats up. The file I am loading is a video, and lets say the size is 320 x 480 the frame resizes to a really tiny window. CRect winRect; CRect tmpRect; GetClientRect(tmpRect); if(!m_media.GetVidSize(winRect)) DoError("Unable to receive size"); GetParentFrame()->MoveWindow(tmpRect.Width(),tmpRect.Height(),winRect.Width(), winRect.Height()); CString str; str.Format("Video Width: %d\nVideo Height: %d\n", winRect.Width(), winRect.Height()); TRACE(str); I can verify that GetVidSize() is returning correct results based upon the TRACE statment wich outputs 320 and 480. Thank you
You have made mistake in the following function call : GetParentFrame()->MoveWindow(tmpRect.Width(),tmpRect.Height(),winRect.Width(), winRect.Height()); First parameter should be X coordinate and second one should be Y coordinate of the screen. So in your case it should be tempRect.TopLeft().x & tempRect.TopLeft().y respectively Regards C.R.Naik
-
I am trying to resize my application based on the size of a loaded file. First I tried to use SetWindowPos() this worked, but did not resize the frame. So I have attempted to use MoveWindow() to do this, and it works.. but not as expected. For example if somebody could review this code fragment and tell me whats up. The file I am loading is a video, and lets say the size is 320 x 480 the frame resizes to a really tiny window. CRect winRect; CRect tmpRect; GetClientRect(tmpRect); if(!m_media.GetVidSize(winRect)) DoError("Unable to receive size"); GetParentFrame()->MoveWindow(tmpRect.Width(),tmpRect.Height(),winRect.Width(), winRect.Height()); CString str; str.Format("Video Width: %d\nVideo Height: %d\n", winRect.Width(), winRect.Height()); TRACE(str); I can verify that GetVidSize() is returning correct results based upon the TRACE statment wich outputs 320 and 480. Thank you
What Kind of application you are developing ? SDI,MDI ? let mw know..:| Vikram
-
What Kind of application you are developing ? SDI,MDI ? let mw know..:| Vikram
Developing an SDI Application.
-
Developing an SDI Application.
The reply from naik is correct. Just check it out...
-
You have made mistake in the following function call : GetParentFrame()->MoveWindow(tmpRect.Width(),tmpRect.Height(),winRect.Width(), winRect.Height()); First parameter should be X coordinate and second one should be Y coordinate of the screen. So in your case it should be tempRect.TopLeft().x & tempRect.TopLeft().y respectively Regards C.R.Naik
Thank you for the correction Chintan, I realized that something was not right with the first two values. However these values reflect were the x,y orgin of the window is if I'm correct in saying that. In my actual code I was using 0,0 and just putting the frame in the upper left corner. Anyways thank you again. You have prolly saved me a little research on how to get the correct coordinates
-
The reply from naik is correct. Just check it out...
Not exactly what I am looking for. The frame still resizes to a very tiny view. I have tried setting the SetMapMode() to different values.. but that has not worked out very well either.
-
Not exactly what I am looking for. The frame still resizes to a very tiny view. I have tried setting the SetMapMode() to different values.. but that has not worked out very well either.
If you are tring in CMainFrame then just use this->MoveWindow(...); else if it is in View use AfxGetMainWnd()->MoveWindow(..); ;)
-
If you are tring in CMainFrame then just use this->MoveWindow(...); else if it is in View use AfxGetMainWnd()->MoveWindow(..); ;)
That is the code that I am using MoveWindow(...) ::MoveWindow(...) GetParentFrame()->MoveWindow(...) AfxGetMainWind()->MoveWindow(...) all produce the same results. The window is resized, but not of the correct size. the CRect structure will have correct numbers for the Width and Height.. however I don't understand how those numbers are being mapped. It seems like 320 is being mapped to 320 mini micro half pixels.
-
That is the code that I am using MoveWindow(...) ::MoveWindow(...) GetParentFrame()->MoveWindow(...) AfxGetMainWind()->MoveWindow(...) all produce the same results. The window is resized, but not of the correct size. the CRect structure will have correct numbers for the Width and Height.. however I don't understand how those numbers are being mapped. It seems like 320 is being mapped to 320 mini micro half pixels.
I think this must be issue between player output coorinates and the co-odinates you are setttig..i think you need to set the View's size ..Is it so?and not whole Window..
-
I think this must be issue between player output coorinates and the co-odinates you are setttig..i think you need to set the View's size ..Is it so?and not whole Window..
Hmmmm.. Using DirectX9 VMR to display a video.. If I use MoveWindow(...) on the view and don't call it through the parent frame .. it sets to the correct size. However the view is never "updated" wether I call Invalidate() or not. so It appears that a Video has plopped on top of the CView window, and will overwrite the status bar, and what not. If I call the funtion through the Frame Window.. It resizes the whole window.. but makes the window tiny.
-
Hmmmm.. Using DirectX9 VMR to display a video.. If I use MoveWindow(...) on the view and don't call it through the parent frame .. it sets to the correct size. However the view is never "updated" wether I call Invalidate() or not. so It appears that a Video has plopped on top of the CView window, and will overwrite the status bar, and what not. If I call the funtion through the Frame Window.. It resizes the whole window.. but makes the window tiny.
see actually the size of the FrameWindow you are considering while resizing.and actually the View needs to be of that size.so just take the framewindows rectangle and view rectangle and fine out what exactly the size you want. that meant your main windows is slightly bigger. and view will be of exact size.In short you need to manipulate the width and height of main window ...by finding the exact difference between upper left and top coordinates of view and Mainframe.
-
see actually the size of the FrameWindow you are considering while resizing.and actually the View needs to be of that size.so just take the framewindows rectangle and view rectangle and fine out what exactly the size you want. that meant your main windows is slightly bigger. and view will be of exact size.In short you need to manipulate the width and height of main window ...by finding the exact difference between upper left and top coordinates of view and Mainframe.
hmm.. that is understandable.. makes scence I guess.. For now I have moved on .. automaticly resizing the default video widht and height isn't a need to have feature I guess, since the user can simply drag the window to whatever size he/she wants.