Jumping Window ?
-
Hi, I've made a little Window with the MFC, but when reposition the window and then select new, the window jums some lines down and some lines right. Did you know how i could avoid this ? void CTestView::OnFileNew() { CRect rc; GetWindowRect (&rc); CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd(); CClientDC dc(this); dc.SetMapMode (MM_TEXT); dc.LPtoDP (&rc); // ClientToScreen (&rc); pFrame->SetWindowPos (&CWnd::wndTop, rc.left, rc.top, 200, 100 ,SWP_NOREPOSITION); } Here is my codr, i hope you can help me ! Many THX CrocodileBuck
-
Hi, I've made a little Window with the MFC, but when reposition the window and then select new, the window jums some lines down and some lines right. Did you know how i could avoid this ? void CTestView::OnFileNew() { CRect rc; GetWindowRect (&rc); CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd(); CClientDC dc(this); dc.SetMapMode (MM_TEXT); dc.LPtoDP (&rc); // ClientToScreen (&rc); pFrame->SetWindowPos (&CWnd::wndTop, rc.left, rc.top, 200, 100 ,SWP_NOREPOSITION); } Here is my codr, i hope you can help me ! Many THX CrocodileBuck
CrocodileBuck wrote:
the window jums some lines down and some lines right. Did you know how i could avoid this ?
Yes. Don't move the window! :) What are you trying to do to the rect there? Mark
"Great job, team. Head back to base for debriefing and cocktails." (Spottswoode "Team America")
-
CrocodileBuck wrote:
the window jums some lines down and some lines right. Did you know how i could avoid this ?
Yes. Don't move the window! :) What are you trying to do to the rect there? Mark
"Great job, team. Head back to base for debriefing and cocktails." (Spottswoode "Team America")
Hi Mark, thx for your quick reply! ! What are you trying to do to the rect there? ! What do you mean exactly ? I need the rect for Set WindowPos() function cause SetWindowPos needs the x and y Coord of the Window. But i onla want to chance the width and height of the window and i want it to keep his place when i move the window and click on new in the menue ! I hope you know what i want and sry for my bad engLish ;) ;) Buck
-
Hi Mark, thx for your quick reply! ! What are you trying to do to the rect there? ! What do you mean exactly ? I need the rect for Set WindowPos() function cause SetWindowPos needs the x and y Coord of the Window. But i onla want to chance the width and height of the window and i want it to keep his place when i move the window and click on new in the menue ! I hope you know what i want and sry for my bad engLish ;) ;) Buck
CrocodileBuck wrote:
I need the rect for Set WindowPos() function cause SetWindowPos needs the x and y Coord of the Window. But i onla want to chance the width and height of the window...
While
SetWindowPos()
is ignoring them, you might want to go ahead and specifiy 0 forx
andy
. The last argument should also be changed toSWP_NOMOVE
.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
CrocodileBuck wrote:
I need the rect for Set WindowPos() function cause SetWindowPos needs the x and y Coord of the Window. But i onla want to chance the width and height of the window...
While
SetWindowPos()
is ignoring them, you might want to go ahead and specifiy 0 forx
andy
. The last argument should also be changed toSWP_NOMOVE
.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
SetWindowPos() ignores nothing ! When i Set X and Y to 0 the Window jumps to the upper left corner of the screen, but i want it to stay where i moved it to. I only want to change the With and height of the window and not its position ! ;) Buck
-
SetWindowPos() ignores nothing ! When i Set X and Y to 0 the Window jumps to the upper left corner of the screen, but i want it to stay where i moved it to. I only want to change the With and height of the window and not its position ! ;) Buck
CrocodileBuck wrote:
SetWindowPos() ignores nothing !
It does if you use it correctly.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
CrocodileBuck wrote:
SetWindowPos() ignores nothing !
It does if you use it correctly.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
OK. coud you pleeeese explain me how i use it correctly???? pleeese i am coding the mfc since 2 weeks and try to solfe this prob since Sunday please david help me to get it working correctly ! ;) Buck
-
OK. coud you pleeeese explain me how i use it correctly???? pleeese i am coding the mfc since 2 weeks and try to solfe this prob since Sunday please david help me to get it working correctly ! ;) Buck
AAAAAAAAAHHHHHRRGGGGGGGGGGHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!! SWP_NOMOVE Retains the current position (ignores X and Y parameters). YYYIIIIIIIIIIPPPIIIIIIEEEEEEYAAAAAAAAAYEEEEEEEEEEEEAAAAAAAAAAAAAHHHHHH! THX David it was you who kicked me to the Flags ;) Buck
-
Hi Mark, thx for your quick reply! ! What are you trying to do to the rect there? ! What do you mean exactly ? I need the rect for Set WindowPos() function cause SetWindowPos needs the x and y Coord of the Window. But i onla want to chance the width and height of the window and i want it to keep his place when i move the window and click on new in the menue ! I hope you know what i want and sry for my bad engLish ;) ;) Buck
I see you have a solution cool! :) I just meant the SetMapMode and LPtoDP stuff. Seems to me simply doing something like this would work - CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd(); CRect rc; pFrame->GetWindowRect (&rc); pFrame->MoveWindow (rc.left, rc.top, 200, 100);
"Great job, team. Head back to base for debriefing and cocktails." (Spottswoode "Team America")
-
AAAAAAAAAHHHHHRRGGGGGGGGGGHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!! SWP_NOMOVE Retains the current position (ignores X and Y parameters). YYYIIIIIIIIIIPPPIIIIIIEEEEEEYAAAAAAAAAYEEEEEEEEEEEEAAAAAAAAAAAAAHHHHHH! THX David it was you who kicked me to the Flags ;) Buck
void CTestView::OnFileNew() { CRect rc; GetWindowRect (&rc); CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd(); CClientDC dc(this); dc.SetMapMode (MM_TEXT); dc.LPtoDP (&rc); // ClientToScreen (&rc); pFrame->SetWindowPos (&CWnd::wndTop, 0, 0, 200, 100 ,SWP_NOREPOSITION|SWP_NOMOVE); //add one more flag SWP_NOMOVE }
life is like a box of chocolate,you never know what you r going to get.