Click here to Skip to main content
15,895,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: SetWindowText problem - please look at that Pin
David Crow28-Jul-04 9:30
David Crow28-Jul-04 9:30 
Generalwhups Pin
bikram singh28-Jul-04 9:46
bikram singh28-Jul-04 9:46 
GeneralWindow OnPaint overrding Pin
act_x28-Jul-04 6:34
act_x28-Jul-04 6:34 
GeneralRe: Window OnPaint overrding Pin
Johan Rosengren28-Jul-04 9:05
Johan Rosengren28-Jul-04 9:05 
GeneralWin Xp vs 2K error Pin
doctorpi28-Jul-04 5:43
doctorpi28-Jul-04 5:43 
GeneralRe: Win Xp vs 2K error Pin
bikram singh28-Jul-04 9:20
bikram singh28-Jul-04 9:20 
GeneralRe: Win Xp vs 2K error Pin
doctorpi28-Jul-04 9:45
doctorpi28-Jul-04 9:45 
GeneralRe: Win Xp vs 2K error Pin
User 58385228-Jul-04 14:49
User 58385228-Jul-04 14:49 
I suspect there are two problems here.
In MoveWindow() you are using two rects that have different origins
This is from CWnd::MoveWindow in MSDN...

For a top-level CWnd object, the x and y parameters are relative to the upper-left corner of the screen. For a child CWnd object, they are relative to the upper-left corner of the parent window’s client area.

so you need to change the code like this

CRect rect,rect3;
m_pParent->GetWindowRect(rect3);
GetWindowRect(rect);
GetParent()->ClientToScreen(&rect);
MoveWindow(rect3.left+381,rect3.top+123,rect.Width(),rect.Height(),TRUE);

The second problem is the use of constants (381 & 123). All sizing and position calculations need to be relative ALWAYS or you will get lots of problems when you change resolution or other display settings.

I suspect that you had to add these because you didnt call ClientToScreen()

What are you trying to acheive here? Is it to put the child window in the center of the parent?

GeneralRe: Win Xp vs 2K error Pin
doctorpi28-Jul-04 22:04
doctorpi28-Jul-04 22:04 
GeneralSTL container over DLL Export Pin
peterchen28-Jul-04 3:41
peterchen28-Jul-04 3:41 
GeneralRe: STL container over DLL Export Pin
vmaltsev28-Jul-04 11:56
vmaltsev28-Jul-04 11:56 
GeneralData Library Pin
sweep12328-Jul-04 3:30
sweep12328-Jul-04 3:30 
GeneralReplacing a substring using a string class Pin
Igor Mihailov28-Jul-04 2:29
Igor Mihailov28-Jul-04 2:29 
GeneralRe: Replacing a substring using a string class Pin
Dimitris Vasiliadis28-Jul-04 2:59
Dimitris Vasiliadis28-Jul-04 2:59 
GeneralBarcode application Pin
Anonymous28-Jul-04 1:40
Anonymous28-Jul-04 1:40 
GeneralCPU Usage For Per Thread(Please Help Me !!!) Pin
A_Fa28-Jul-04 1:28
A_Fa28-Jul-04 1:28 
GeneralRe: CPU Usage For Per Thread(Please Help Me !!!) Pin
basementman28-Jul-04 4:10
basementman28-Jul-04 4:10 
GeneralRe: CPU Usage For Per Thread(Please Help Me !!!) Pin
A_Fa28-Jul-04 20:43
A_Fa28-Jul-04 20:43 
GeneralRe: CPU Usage For Per Thread(Please Help Me !!!) Pin
David Crow28-Jul-04 6:07
David Crow28-Jul-04 6:07 
GeneralRe: CPU Usage For Per Thread(Please Help Me !!!) Pin
A_Fa28-Jul-04 22:19
A_Fa28-Jul-04 22:19 
GeneralDefault user credentials with WinInet Pin
cheesepirate28-Jul-04 1:17
cheesepirate28-Jul-04 1:17 
Generalstatically linking an executable Pin
Anonymous28-Jul-04 0:04
Anonymous28-Jul-04 0:04 
GeneralRe: statically linking an executable Pin
Johan Rosengren28-Jul-04 9:10
Johan Rosengren28-Jul-04 9:10 
QuestionLPWSTR substring? Pin
ting66827-Jul-04 22:39
ting66827-Jul-04 22:39 
AnswerRe: LPWSTR substring? Pin
Dimitris Vasiliadis28-Jul-04 3:17
Dimitris Vasiliadis28-Jul-04 3:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.