Win32 to MFC
-
Hello All, I have used the List Control in Win32, same i want to implement in MFC, i am unable to do that can anyone help me with this. Extracting the contents of the list Box in Win 32.
HWND hList = GetDlgItem(hwnd, IDC_FLIST);
int count = SendMessage(hList, LB_GETCOUNT, 0, 0);
for ( int i=0; i < count ; i++ )
{
int itemTextLen = SendMessage(hList, LB_GETTEXTLEN, i, 0);
char *itemText = new char[itemTextLen];
SendMessage(hList, LB_GETTEXT, i, (LPARAM)itemText);
}MFC:-
int ListSize;
ListSize = m_WLinks.GetCount();
for(int i=0;i<=ListSize;i++)
{
}In Win32 i had handle so got the control of the list box but how to do that in MFC ? Thanking you, Naveen HS.
-
Hello All, I have used the List Control in Win32, same i want to implement in MFC, i am unable to do that can anyone help me with this. Extracting the contents of the list Box in Win 32.
HWND hList = GetDlgItem(hwnd, IDC_FLIST);
int count = SendMessage(hList, LB_GETCOUNT, 0, 0);
for ( int i=0; i < count ; i++ )
{
int itemTextLen = SendMessage(hList, LB_GETTEXTLEN, i, 0);
char *itemText = new char[itemTextLen];
SendMessage(hList, LB_GETTEXT, i, (LPARAM)itemText);
}MFC:-
int ListSize;
ListSize = m_WLinks.GetCount();
for(int i=0;i<=ListSize;i++)
{
}In Win32 i had handle so got the control of the list box but how to do that in MFC ? Thanking you, Naveen HS.
-
Hello All, I have used the List Control in Win32, same i want to implement in MFC, i am unable to do that can anyone help me with this. Extracting the contents of the list Box in Win 32.
HWND hList = GetDlgItem(hwnd, IDC_FLIST);
int count = SendMessage(hList, LB_GETCOUNT, 0, 0);
for ( int i=0; i < count ; i++ )
{
int itemTextLen = SendMessage(hList, LB_GETTEXTLEN, i, 0);
char *itemText = new char[itemTextLen];
SendMessage(hList, LB_GETTEXT, i, (LPARAM)itemText);
}MFC:-
int ListSize;
ListSize = m_WLinks.GetCount();
for(int i=0;i<=ListSize;i++)
{
}In Win32 i had handle so got the control of the list box but how to do that in MFC ? Thanking you, Naveen HS.
good morning in MFC what you can do is define a member in your mydialog.h CListBox m_MyListBox; use DDX to link you member with the control. DDX_Control(pDX, IDC_MYLIST_BOX, m_MyListBox) Then to read the content CString sText; int ListSize = m_WLinks.GetCount(); for(int i=0; i!=ListSize; ++i) { m_MyListBox.GetText(iIndex, sText); } Regards Franck
-
good morning in MFC what you can do is define a member in your mydialog.h CListBox m_MyListBox; use DDX to link you member with the control. DDX_Control(pDX, IDC_MYLIST_BOX, m_MyListBox) Then to read the content CString sText; int ListSize = m_WLinks.GetCount(); for(int i=0; i!=ListSize; ++i) { m_MyListBox.GetText(iIndex, sText); } Regards Franck