Trad
New Member
Posts: 1,122
|
Post by Trad on May 18, 2003 10:26:55 GMT -5
Ok, this is for anyone who is into Win32 (hint hint f00k, where are you???) i want this part of my WndProc to add all files in a directory to a listbox in my directory, and i have totally screwed this up. help br] switch (LOWORD(wParam)) { case IDC_BUTTON2: { HWND hwndlist; hwndlist = GetDlgItem(hWnd,IDC_STEXT); char szSearchFile[128]; GetWindowText(GetDlgItem(hWnd,IDC_EDIT),szSearchFile,128); SetCurrentDirectory("C:\\Alex"); HANDLE hfile; WIN32_FIND_DATA hdata; hfile = FindFirstFile("*.*",&hdata); while(FindNextFile(hfile,&hdata)) { count++; } hfile = FindFirstFile("*.*",&hdata); for (int i=0; i<count; i++) { if (i==0) { SendMessage(hWnd, LB_ADDSTRING, 0, (LPARAM) hdata.cFileName); SendMessage(hWnd, LB_SETITEMDATA, i, (LPARAM) i); } FindNextFile(hfile,&hdata); SendMessage(hwndlist, LB_ADDSTRING, 0, (LPARAM) hdata.cFileName); SendMessage(hwndlist, LB_SETITEMDATA, i, (LPARAM) i); } } I want the listbox (ID_STEXT) to be filled with files from my Directory.
|
|