ListBox controls
-
I'm trying to make a simple menu, with a Listbox and a butten.. The Listbox will contain a lists of programs, and the button will execute the program selected on the list box.. I created a simple Dialog base App(no mfc) But I can figure out how to input data in the list box.. Like. LIST_GAMES ---------- Quake DOOM Half-Life How to do this ? :) Thanks
-
I'm trying to make a simple menu, with a Listbox and a butten.. The Listbox will contain a lists of programs, and the button will execute the program selected on the list box.. I created a simple Dialog base App(no mfc) But I can figure out how to input data in the list box.. Like. LIST_GAMES ---------- Quake DOOM Half-Life How to do this ? :) Thanks
For add a string into ListBox try: ListBox.InsertItem(0,"you string"); If you want scan a directory, find files and add this in the ListBox: CFileFind finder; BOOL bWorking; CString fullpath; strPath = strPath + "*.*"; bWorking = finder.FindFile(strPath); while (bWorking) { bWorking = finder.FindNextFile(); if ( !finder.IsDirectory()) { CTime FileTime; CString strFileName,strFileTime; strFileName = fullpath+finder.GetFileName(); finder.GetLastWriteTime(FileTime); strFileTime = FileTime.Format("%Y/%m/%d %H.%M"); SHFILEINFO shinfo; SHGetFileInfo( strFileName, 0, &shinfo, sizeof( shinfo ), SHGFI_ICON | SHGFI_SMALLICON ); int j = InsertItem(0,finder.GetFileName()); SetItemText (j,1,strFileTime); //2nd column } } //end while
-
For add a string into ListBox try: ListBox.InsertItem(0,"you string"); If you want scan a directory, find files and add this in the ListBox: CFileFind finder; BOOL bWorking; CString fullpath; strPath = strPath + "*.*"; bWorking = finder.FindFile(strPath); while (bWorking) { bWorking = finder.FindNextFile(); if ( !finder.IsDirectory()) { CTime FileTime; CString strFileName,strFileTime; strFileName = fullpath+finder.GetFileName(); finder.GetLastWriteTime(FileTime); strFileTime = FileTime.Format("%Y/%m/%d %H.%M"); SHFILEINFO shinfo; SHGetFileInfo( strFileName, 0, &shinfo, sizeof( shinfo ), SHGFI_ICON | SHGFI_SMALLICON ); int j = InsertItem(0,finder.GetFileName()); SetItemText (j,1,strFileTime); //2nd column } } //end while