How to insert data into ListBox(Something Different)

Hi All,

I am using Win32 Application. In that I have created resource as Dialog and also in this Dialog I have added onr ListBox control. Now I want to insert data in to this Dialog.

In this I have added one C++ class in which I am using like below to open Dialog....

void CCurrentWnd::Open()
{
DialogBoxParam(hAppInstance,MAKEINTRESOURCE(IDD_CURWND),NULL,(DLGPROC)CurrntWndDlgProc,(LONG)this);
}

As shown in above code my CurrentDlgProc is shown as below...

BOOL CCurrentWnd::CurrntWndDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
CCurrentWnd * _this = (CCurrentWnd *)GetWindowLong(hwnd,GWL_USERDATA);
switch(uMsg)
{

case WM_INITDIALOG:
{
HWND m_list1;

m_list1 = GetDlgItem(hwnd,IDC_WNDLIST);

//Now here I got the handle of the ListBox
// Now How to insert data in
//this ListBox from here within this class.
}
//Any code


Here IDC_WNDLIST is the ID of the ListBox control.
Is there any method for ListBox control as in Tab control like TabCtrl_InsertItem().?

If you know any other alternative then plz reply me.

Thanks in Advance.
[1596 byte] By [ashishbhatt12] at [2007-11-20 11:43:51]
# 1 Re: How to insert data into ListBox(Something Different)
Hi,

us the following code to add a string to a ListBoxint index = SendMessage(m_list1, LB_ADDSTRING, 0, (LPARAM)_T("Your string"));
LE: the returned value will be the index of your string in the list, if the call was successful or LB_ERR otherwise.
EoF at 2007-11-10 22:23:09 >