Click here to Skip to main content
15,900,254 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
SuggestionRe: How to write Benford’s Law in C++ Need Help Pin
David Crow21-Aug-13 6:26
David Crow21-Aug-13 6:26 
QuestionCTabCtrl header colour anomaly in CPaneDialog Pin
D G McKay20-Aug-13 2:07
D G McKay20-Aug-13 2:07 
AnswerRe: CTabCtrl header colour anomaly in CPaneDialog Pin
D G McKay2-Sep-13 0:14
D G McKay2-Sep-13 0:14 
QuestionWindow Position Pin
john563218-Aug-13 19:44
john563218-Aug-13 19:44 
AnswerRe: Window Position Pin
Richard MacCutchan18-Aug-13 20:56
mveRichard MacCutchan18-Aug-13 20:56 
GeneralRe: Window Position Pin
john563219-Aug-13 4:11
john563219-Aug-13 4:11 
GeneralRe: Window Position Pin
Richard MacCutchan19-Aug-13 5:06
mveRichard MacCutchan19-Aug-13 5:06 
GeneralRe: Window Position Pin
pasztorpisti19-Aug-13 6:09
pasztorpisti19-Aug-13 6:09 
Relative to what? Child window positions in WinAPI are expressed in the client coordinates of its parent while GetWindowPos always returns screen coordinates. For this reason after getting the screen coordinates of the child control you probably want to transform them into the client coordinate space of the parent control.
C++
pChild->GetWindowRect(&rt);
pParent->ScreenToClient(&rt);

In contrast to this MoveWindow() and SetWindowPos() expect coordinates that are in the client coordinates of the parent window (that is the screen for top level windows). Always read the docs about the expression of coordinates. For example in case of mouse messages you always receive mouse pos in client coordinates of the control that receives the message but there is one exception: WM_MOUSEWHEEL returns screen coordinates. So: Read docs!!!

modified 19-Aug-13 12:20pm.

GeneralRe: Window Position Pin
Richard MacCutchan19-Aug-13 20:33
mveRichard MacCutchan19-Aug-13 20:33 
GeneralRe: Window Position Pin
pasztorpisti20-Aug-13 2:03
pasztorpisti20-Aug-13 2:03 
QuestionRe: Window Position Pin
pasztorpisti18-Aug-13 23:47
pasztorpisti18-Aug-13 23:47 
QuestionSometimes it can not draw out graph Pin
xieeevil18-Aug-13 17:04
xieeevil18-Aug-13 17:04 
AnswerRe: Sometimes it can not draw out graph Pin
Richard MacCutchan18-Aug-13 20:38
mveRichard MacCutchan18-Aug-13 20:38 
GeneralRe: Sometimes it can not draw out graph Pin
Rajesh R Subramanian18-Aug-13 21:57
professionalRajesh R Subramanian18-Aug-13 21:57 
GeneralRe: Sometimes it can not draw out graph Pin
Richard MacCutchan18-Aug-13 22:09
mveRichard MacCutchan18-Aug-13 22:09 
GeneralRe: Sometimes it can not draw out graph Pin
Vaclav_21-Aug-13 4:30
Vaclav_21-Aug-13 4:30 
GeneralRe: Sometimes it can not draw out graph Pin
Richard MacCutchan21-Aug-13 5:09
mveRichard MacCutchan21-Aug-13 5:09 
QuestionWaitForSingleObject Crash Pin
ForNow18-Aug-13 14:09
ForNow18-Aug-13 14:09 
AnswerRe: WaitForSingleObject Crash Pin
Stephen Hewitt18-Aug-13 19:53
Stephen Hewitt18-Aug-13 19:53 
AnswerRe: WaitForSingleObject Crash Pin
Erudite_Eric18-Aug-13 20:07
Erudite_Eric18-Aug-13 20:07 
GeneralRe: WaitForSingleObject Crash Pin
ForNow19-Aug-13 4:45
ForNow19-Aug-13 4:45 
GeneralRe: WaitForSingleObject Crash Pin
Jochen Arndt19-Aug-13 5:14
professionalJochen Arndt19-Aug-13 5:14 
GeneralRe: WaitForSingleObject Crash Pin
ForNow19-Aug-13 5:20
ForNow19-Aug-13 5:20 
GeneralRe: WaitForSingleObject Crash Pin
Stephen Hewitt19-Aug-13 20:32
Stephen Hewitt19-Aug-13 20:32 
AnswerRe: WaitForSingleObject Crash Pin
Richard MacCutchan18-Aug-13 20:35
mveRichard MacCutchan18-Aug-13 20:35 

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.