I'm programming with DEV C++. I creatred one form with 3 listboxes, but only on the first I can add items (rwos), the others two seems to be active but not managed by the program.
To create the listboxes I worte, under the WM_CREATE:
hWndListBox1 = CreateWindowEx(0,"LISTBOX", NULL, WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_BORDER, 30, 30, 200, 800, hwnd, (HMENU)IDC_LISTBOX_TEXT1, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL); if (!hwnd) MessageBox(NULL, "ListBox 1 Failed.", "Error", MB_OK | MB_ICONERROR); SendDlgItemMessage(hwnd, IDC_LISTBOX_TEXT1, WM_SETFONT, (WPARAM)hFont_list, TRUE);
hWndListBox2 = CreateWindowEx(0,"LISTBOX", NULL, WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_BORDER, 330, 400, 200, 418, hwnd, (HMENU)IDC_LISTBOX_TEXT2, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL); if (!hwnd) MessageBox(NULL, "ListBox 2 Failed.", "Error", MB_OK | MB_ICONERROR); SendDlgItemMessage(hwnd, IDC_LISTBOX_TEXT2, WM_SETFONT, (WPARAM)hFont_list, TRUE);
hWndListBox3 = CreateWindowEx(0,"LISTBOX", NULL, WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_BORDER, 600, 400, 200, 418, hwnd, (HMENU)IDC_LISTBOX_TEXT3, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL); if (!hwnd) MessageBox(NULL, "ListBox 3 Failed.", "Error", MB_OK | MB_ICONERROR); SendDlgItemMessage(hwnd, IDC_LISTBOX_TEXT3, WM_SETFONT, (WPARAM)hFont_list, TRUE);
The first listbox runs with the call: SendMessage(GetDlgItem(hwnd, IDC_LISTBOX_TEXT1), LB_ADDSTRING, 0, (LPARAM)Testo_Val1);
To add items on the listbox 2 I use: SendMessage(GetDlgItem(hWndListBox2, IDC_LISTBOX_TEXT2), LB_ADDSTRING, 0, (LPARAM)Testo_Val2);
but on the listbox 3 I tried with: SendMessage(hWndListBox2, LB_ADDSTRING, 0, (LPARAM)Testo_Val2);
I also tied with: SendMessage(GetDlgItem(hwnd, IDC_LISTBOX_TEXT3), LB_ADDSTRING, 0, (LPARAM)Testo_Val2);
but without any result.
I can't understand why the listboxes 2 and 3 aren't managed.
NOTE:
char Testo_Val1[25]; char Testo_Val2[25]; char Testo_Val3[25];
Thanks in advance for any help!!!
Log in to post a comment.
I'm programming with DEV C++.
I creatred one form with 3 listboxes, but only on the first I can add items (rwos), the others two seems to be active but not managed by the program.
To create the listboxes I worte, under the WM_CREATE:
hWndListBox1 = CreateWindowEx(0,"LISTBOX", NULL, WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_BORDER,
30, 30, 200, 800, hwnd, (HMENU)IDC_LISTBOX_TEXT1, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
if (!hwnd)
MessageBox(NULL, "ListBox 1 Failed.", "Error", MB_OK | MB_ICONERROR);
SendDlgItemMessage(hwnd, IDC_LISTBOX_TEXT1, WM_SETFONT, (WPARAM)hFont_list, TRUE);
hWndListBox2 = CreateWindowEx(0,"LISTBOX", NULL, WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_BORDER,
330, 400, 200, 418, hwnd, (HMENU)IDC_LISTBOX_TEXT2, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
if (!hwnd)
MessageBox(NULL, "ListBox 2 Failed.", "Error", MB_OK | MB_ICONERROR);
SendDlgItemMessage(hwnd, IDC_LISTBOX_TEXT2, WM_SETFONT, (WPARAM)hFont_list, TRUE);
hWndListBox3 = CreateWindowEx(0,"LISTBOX", NULL, WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_BORDER,
600, 400, 200, 418, hwnd, (HMENU)IDC_LISTBOX_TEXT3, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
if (!hwnd)
MessageBox(NULL, "ListBox 3 Failed.", "Error", MB_OK | MB_ICONERROR);
SendDlgItemMessage(hwnd, IDC_LISTBOX_TEXT3, WM_SETFONT, (WPARAM)hFont_list, TRUE);
The first listbox runs with the call:
SendMessage(GetDlgItem(hwnd, IDC_LISTBOX_TEXT1), LB_ADDSTRING, 0, (LPARAM)Testo_Val1);
To add items on the listbox 2 I use:
SendMessage(GetDlgItem(hWndListBox2, IDC_LISTBOX_TEXT2), LB_ADDSTRING, 0, (LPARAM)Testo_Val2);
but on the listbox 3 I tried with:
SendMessage(hWndListBox2, LB_ADDSTRING, 0, (LPARAM)Testo_Val2);
I also tied with:
SendMessage(GetDlgItem(hwnd, IDC_LISTBOX_TEXT3), LB_ADDSTRING, 0, (LPARAM)Testo_Val2);
but without any result.
I can't understand why the listboxes 2 and 3 aren't managed.
NOTE:
char Testo_Val1[25];
char Testo_Val2[25];
char Testo_Val3[25];
Thanks in advance for any help!!!