-
November 2nd, 2013, 01:37 PM
#1
win32 listbox not populating right
Hi guys,
This is my first posting here, i am trying to learn to program a win32 GUI in code blocks 12.11, but here is the problem,
I have got 2x list boxes on a dialog box window(IDC_LIST1 > Personal Project Notes) and (IDC_LIST2 > Shared Project Notes),see attached pic,
,
The (personal project notes) auto populates on the dialog been created, i can also get the (Shared project notes) to populate from a folder(by clicking button),see attached pic,
,
The problem arises when i click the button(update personal) after clicking the(update shared ), it loads the contents of (shared project notes) into the(personal project notes) list box, even after using the clear button too, this still populates (the personal project notes) when clicking the (update personal)button, see attached pic,
,
please could someone help me resolve this problem, has i have been banging my head against a wall for days now,
This is the code i have been currently experimenting with, please excuse the messy code, as most of it is from examples that i have converted to suit my GUI.
Code:
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam){
switch(Message){
case WM_INITDIALOG:
CheckRadioButton(HWND (hwnd),IDRADIO, IDRADIO2, IDRADIO);
{
DlgDirList(HWND (ID_PROJECT_PROJECT_NOTES), pbuffer, IDC_LISTP, 0, DDL_EXCLUSIVE);
HWND hListBox = GetDlgItem(hwnd, IDC_LISTP);
SendMessage(hListBox, LB_DIR, 0, (LPARAM)("*.txt*"));
}
break;
case WM_COMMAND:
switch(LOWORD(wParam)){
case ID_UPDATEP:{
SendDlgItemMessage(HWND(hwnd), IDC_LISTP, LB_RESETCONTENT, 0, 0);
DlgDirList(HWND (ID_PROJECT_PROJECT_NOTES), pbuffer, IDC_LISTP, 0, DDL_EXCLUSIVE);
HWND hListBox = GetDlgItem(hwnd, IDC_LISTP);
SendMessage(hListBox, LB_DIR, 0, (LPARAM)("*.txt"));
}
break;
case ID_UPDATES:{
SendDlgItemMessage(HWND(hwnd), IDC_LISTS, LB_RESETCONTENT, 0, 0);
DlgDirList(HWND (ID_PROJECT_PROJECT_NOTES), sbuffer, IDC_LISTS, 0, DDL_EXCLUSIVE);
HWND hList = GetDlgItem(hwnd, IDC_LISTS);
SendMessage(hList, LB_DIR, 0, (LPARAM)("*.txt"));
}
break;
case IDCLEAR:
SendDlgItemMessage(HWND(hwnd), IDC_LISTP, LB_RESETCONTENT, 0, 0);
SendDlgItemMessage(HWND(hwnd), IDC_LISTS, LB_RESETCONTENT, 0, 0);
break;
case IDCREATE:{
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDPAD), NULL, DlgProc);
}
break;
case IDOK:
EndDialog(hwnd, IDOK);
break;
case IDCANCEL:
EndDialog(hwnd, IDCANCEL);
break;
}
break;
case WM_CLOSE:
EndDialog(hwnd, 0);
break;
default:
return FALSE;
}
return TRUE;
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|