Click here to Skip to main content
15,908,618 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Inconsistency behaviour of APIs - Help me Pin
David Crow30-Dec-04 3:06
David Crow30-Dec-04 3:06 
Generalsending midi thru usb!!!!!anyone plz help!!!! Pin
namaskaaram29-Dec-04 21:10
namaskaaram29-Dec-04 21:10 
Questionimporting third party library? Pin
Maverick29-Dec-04 20:31
Maverick29-Dec-04 20:31 
AnswerRe: importing third party library? Pin
Maverick29-Dec-04 21:01
Maverick29-Dec-04 21:01 
GeneralWindows service Pin
hou_12629-Dec-04 18:53
hou_12629-Dec-04 18:53 
GeneralRe: Windows service Pin
Joel Holdsworth30-Dec-04 1:50
Joel Holdsworth30-Dec-04 1:50 
GeneralA question about GetDlgItem Pin
IsaacLitingjun29-Dec-04 16:20
IsaacLitingjun29-Dec-04 16:20 
GeneralRe: A question about GetDlgItem Pin
Rahim Rattani29-Dec-04 19:21
Rahim Rattani29-Dec-04 19:21 
First Obtain the ptr of view class "CvcydcjView"
as

CMainFrame* pMainFrmWnd = (CMainFrame*)AfxGetMainWnd();<br />
ASSERT(pMainFrmWnd != NULL);<br />
CvcydcjView* pYourView = NULL;<br />
CWnd* pchildWnd = pMainFrmWnd->GetWindow(GW_CHILD);<br />
ASSERT(pchildWnd->GetSafeHwnd() != NULL);<br />
while(childWnd->GetSafeHwnd() != NULL)<br />
  {<br />
    ASSERT(childWnd->GetSafeHwnd() != NULL);<br />
    if(childWnd->GetRuntimeClass()->m_lpszClassName == "CvcydcjView")<br />
      {<br />
	pYourView = (CvcydcjView*)childWnd;<br />
        break;<br />
      }<br />
    childWnd = childWnd->GetWindow(GW_HWNDNEXT);<br />
  }<br />
ASSERT(pYourView != NULL);


Now you have got ptr to your class you can call the functions as

CListCtrl* pList = (CListCtrl*)pYourView->GetDlgItem( IDC_LIST_MEM);<br />
pList->InsertColumn(0, "TestColumn", LVCFMT_CENTER,40);


At the moment i dont remember whether GetDlgItem() is public or not.
If its not public create your own function that should be public which calls GetDlgItem inside the class as

The below is the public function
CWnd* CvcydcjView::getItem(UINT p_nResourceID)<br />
{<br />
  return GetDlgItem(p_nResourceID);<br />
}


now call this function form your other class as
CListCtrl* pList = (CListCtrl*)pYourView->getItem( IDC_LIST_MEM);<br />
pList->InsertColumn(0, "TestColumn", LVCFMT_CENTER,40);




..RR..
GeneralRe: A question about GetDlgItem Pin
IsaacLitingjun29-Dec-04 20:23
IsaacLitingjun29-Dec-04 20:23 
GeneralRe: A question about GetDlgItem Pin
Rahim Rattani29-Dec-04 20:54
Rahim Rattani29-Dec-04 20:54 
GeneralRe: A question about GetDlgItem Pin
IsaacLitingjun29-Dec-04 21:26
IsaacLitingjun29-Dec-04 21:26 
GeneralRe: A question about GetDlgItem Pin
Rahim Rattani30-Dec-04 17:56
Rahim Rattani30-Dec-04 17:56 
Generali'm so ashamed! ... Pin
IsaacLitingjun30-Dec-04 18:25
IsaacLitingjun30-Dec-04 18:25 
GeneralAnd Learn this! ^.^ Pin
IsaacLitingjun29-Dec-04 20:47
IsaacLitingjun29-Dec-04 20:47 
GeneralThanks a billion !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Pin
IsaacLitingjun30-Dec-04 18:35
IsaacLitingjun30-Dec-04 18:35 
GeneralThank you Thank you! ^.^ Pin
IsaacLitingjun30-Dec-04 18:40
IsaacLitingjun30-Dec-04 18:40 
GeneralSth. wrong with thread Pin
IsaacLitingjun6-Jan-05 16:27
IsaacLitingjun6-Jan-05 16:27 
GeneralRe: Sth. wrong with thread Pin
Rahim Rattani6-Jan-05 17:10
Rahim Rattani6-Jan-05 17:10 
GeneralRe: Sth. wrong with thread Pin
IsaacLitingjun6-Jan-05 18:41
IsaacLitingjun6-Jan-05 18:41 
GeneralRe: Sth. wrong with thread Pin
Rahim Rattani6-Jan-05 18:50
Rahim Rattani6-Jan-05 18:50 
GeneralI'm really so lucky!! Pin
IsaacLitingjun6-Jan-05 19:13
IsaacLitingjun6-Jan-05 19:13 
GeneralProblem solved, thx! Pin
IsaacLitingjun8-Jan-05 16:05
IsaacLitingjun8-Jan-05 16:05 
GeneralUsing this can solve that problem Pin
IsaacLitingjun6-Jan-05 18:50
IsaacLitingjun6-Jan-05 18:50 
GeneralRe: A question about GetDlgItem Pin
V.29-Dec-04 21:07
professionalV.29-Dec-04 21:07 
GeneralRe: A question about GetDlgItem Pin
Joseph M. Newcomer31-Dec-04 5:49
Joseph M. Newcomer31-Dec-04 5:49 

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.