Click here to Skip to main content
15,916,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Count Character in string Pin
Cedric Moonen20-Nov-07 21:44
Cedric Moonen20-Nov-07 21:44 
GeneralRe: Count Character in string (even faster) Pin
bolivar12321-Nov-07 3:06
bolivar12321-Nov-07 3:06 
QuestionCWnd Pin
kk.tvm20-Nov-07 19:07
kk.tvm20-Nov-07 19:07 
AnswerRe: CWnd Pin
Hamid_RT20-Nov-07 19:11
Hamid_RT20-Nov-07 19:11 
GeneralRe: CWnd Pin
kk.tvm20-Nov-07 21:11
kk.tvm20-Nov-07 21:11 
GeneralRe: CWnd Pin
Hamid_RT20-Nov-07 21:18
Hamid_RT20-Nov-07 21:18 
QuestionHow to SetWindowPos correctly? Actually confused with GetClientRect,GetWindowRect,ScreenToClient and ClientToScreen etc. Pin
fantasy121520-Nov-07 18:36
fantasy121520-Nov-07 18:36 
AnswerRe: How to SetWindowPos correctly? Actually confused with GetClientRect,GetWindowRect,ScreenToClient and ClientToScreen etc. Pin
Mark Salsbery20-Nov-07 19:01
Mark Salsbery20-Nov-07 19:01 
GetWindowRect()  gets coords relative to the screen.
SetWindowPos() is expecting coords relative to the parents client area.

BOOL CMyDialog::OnInitDialog()
{
  CDialog::OnInitDialog();
  m_ctlBox.Create(STYLE, CRect(0, 0, 0, 0), <font color="Red">this</font>);
  m_ctlBox.ShowWindow(SW_HIDE); <font color="Green">//<-- you could create the window without the WS_VISIBLE style to avoid potential flash doing this</font>

  //below code to set the position for the CListBox
  CRect rcOK;
  GetDlgItem(IDOK)->GetWindowRect(&rcOK);
  int nBoxWidth = 30;
  int nBoxHeight = 40;
  int nxMargin = 10;
<font color="Red">  CPoint BoxUpperLeft;
  BoxUpperLeft.y = rcOK.top;
  BoxUpperLeft.x = rcOK.left - nxMargin - nBoxWidth;
  ScreenToClient(&BoxUpperLeft);  <font color="Green">//<-- converts screen coords to coords relative to this window</font>
</font>  m_ctlBox.SetWindowPos(&CWnd::wndTop, <font color="Red">BoxUpperLeft.x</font>, <font color="Red">BoxUpperLeft.y</font>, nBoxWidth, nBoxHeight, SWP_SHOWWINDOW);
  m_ctlBox.ShowWindow(SW_SHOW);
  return TRUE;
}
Mark





Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: How to SetWindowPos correctly? Actually confused with GetClientRect,GetWindowRect,ScreenToClient and ClientToScreen etc. [modified] Pin
fantasy121520-Nov-07 20:34
fantasy121520-Nov-07 20:34 
GeneralRe: How to SetWindowPos correctly? Actually confused with GetClientRect,GetWindowRect,ScreenToClient and ClientToScreen etc. Pin
Parthi_Appu21-Nov-07 0:25
Parthi_Appu21-Nov-07 0:25 
QuestionRe: How to SetWindowPos correctly? Actually confused with GetClientRect,GetWindowRect,ScreenToClient and ClientToScreen etc. [Understood clearly] Pin
fantasy121521-Nov-07 13:59
fantasy121521-Nov-07 13:59 
GeneralRe: How to SetWindowPos correctly? Actually confused with GetClientRect,GetWindowRect,ScreenToClient and ClientToScreen etc. Pin
Mark Salsbery21-Nov-07 5:15
Mark Salsbery21-Nov-07 5:15 
QuestionGetWindowText in OnKeyDown not correct Pin
followait20-Nov-07 18:26
followait20-Nov-07 18:26 
AnswerRe: GetWindowText in OnKeyDown not correct Pin
Hamid_RT20-Nov-07 18:35
Hamid_RT20-Nov-07 18:35 
GeneralRe: GetWindowText in OnKeyDown not correct Pin
followait20-Nov-07 18:40
followait20-Nov-07 18:40 
AnswerRe: GetWindowText in OnKeyDown not correct Pin
Haroon Sarwar20-Nov-07 18:36
Haroon Sarwar20-Nov-07 18:36 
GeneralRe: GetWindowText in OnKeyDown not correct Pin
followait20-Nov-07 18:40
followait20-Nov-07 18:40 
AnswerRe: GetWindowText in OnKeyDown not correct Pin
fantasy121520-Nov-07 18:42
fantasy121520-Nov-07 18:42 
Questiontchar to constant char mfc-vc++ Pin
Paulraj G20-Nov-07 17:46
Paulraj G20-Nov-07 17:46 
AnswerRe: tchar to constant char mfc-vc++ Pin
followait20-Nov-07 18:33
followait20-Nov-07 18:33 
QuestionRe: tchar to constant char mfc-vc++ Pin
nitin320-Nov-07 20:03
nitin320-Nov-07 20:03 
AnswerRe: tchar to constant char mfc-vc++ Pin
Cedric Moonen20-Nov-07 20:10
Cedric Moonen20-Nov-07 20:10 
GeneralRe: tchar to constant char mfc-vc++ Pin
Paulraj G21-Nov-07 23:43
Paulraj G21-Nov-07 23:43 
QuestionIE Addin Sample code Pin
Adam °Wimsatt20-Nov-07 15:59
Adam °Wimsatt20-Nov-07 15:59 
AnswerRe: IE Addin Sample code Pin
Adam °Wimsatt20-Nov-07 16:01
Adam °Wimsatt20-Nov-07 16:01 

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.