As Total Commander quickly opens a folder?
As Total Commander quickly opens a folder?
As Total Commander quickly opens a folder? When iterating through FindFirstFile - FindNextFile very long obtained in folders on the 3000 - 4000 files. If you point to examples, I would be grateful.
FindFirst and FindNext are fast enough to search folders
Incorrectly manipulating 3000 or 4000 files can slow down your GUI.
Listing ~30,000 files while CACHED takes less than one second using FindFirst and FindNext...
Look this spaghetti implementation of folder search:
http://amib.ir/downloads/FolderSearch_FB.zip
http://www.freebasic.net/forum/viewtopic.php?p=91093
Incorrectly manipulating 3000 or 4000 files can slow down your GUI.
Listing ~30,000 files while CACHED takes less than one second using FindFirst and FindNext...
Look this spaghetti implementation of folder search:
http://amib.ir/downloads/FolderSearch_FB.zip
http://www.freebasic.net/forum/viewtopic.php?p=91093
AMIBCT wrote:FindFirst and FindNext are fast enough to search folders
Incorrectly manipulating 3000 or 4000 files can slow down your GUI.
Listing ~30,000 files while CACHED takes less than one second using FindFirst and FindNext...
Look this spaghetti implementation of folder search:
http://amib.ir/downloads/FolderSearch_FB.zip
http://www.freebasic.net/forum/viewtopic.php?p=91093
Thank you, I look
Соглашаюсь FindFirst работает быстро, но если заносить в ListView то при 3000 файлов 2-3 секунды. А в Total мгновенно! Какие там методы, подскажите пожалуйста?
Agree FindFirst is fast, but if you bring in the ListView then 3000 files 2-3 seconds. And in Total Commander or Explorer instantly! What methods are there, tell me please?
Agree FindFirst is fast, but if you bring in the ListView then 3000 files 2-3 seconds. And in Total Commander or Explorer instantly! What methods are there, tell me please?
I think maybe Explorer is remembering (caching) the tree of files/directories, so it doesn't have to re-read them all the time you switch folders in the Explorer window. I know that you can use F5 to refresh/reload the tree, but Explorer also does automatic updates, maybe with something like FindFirstChangeNotification & others. That caching and refreshing behavior is definitely necessary for directories from computers from a network.
Besides that I think that the Explorer (or whatever is responsible for it) already reads in and caches directories at system start up, for example the Desktop, so that may explain why it can show directories so fast even when you just opened them for the first time.
Or maybe it just has a very close connection to the file system, I don't know.
The list view in the GUI is a different problem, maybe it only shows as much as fits on screen, or has a certain limit (but still adjusts the scrollbar as needed). It would be pointless to load 3000 files into it if you can only see 100 at a time on your screen. Of course it's also possible that they're using a customized or completely custom list view control.
And I'd expect it all to be multi-threaded, so the GUI doesn't hang or freeze.
Besides that I think that the Explorer (or whatever is responsible for it) already reads in and caches directories at system start up, for example the Desktop, so that may explain why it can show directories so fast even when you just opened them for the first time.
Or maybe it just has a very close connection to the file system, I don't know.
The list view in the GUI is a different problem, maybe it only shows as much as fits on screen, or has a certain limit (but still adjusts the scrollbar as needed). It would be pointless to load 3000 files into it if you can only see 100 at a time on your screen. Of course it's also possible that they're using a customized or completely custom list view control.
And I'd expect it all to be multi-threaded, so the GUI doesn't hang or freeze.
The ListView Control is quite slow - maybe that's your problem.
Try using a virtual ListView. A virtual listbox only knows how many items it contains in total and the items it needs to display. So you can display thousands or millions of items in your ListView.
See http://msdn.microsoft.com/en-us/library ... 85%29.aspx ("Virtual List-View Style") for further reference.
Try using a virtual ListView. A virtual listbox only knows how many items it contains in total and the items it needs to display. So you can display thousands or millions of items in your ListView.
See http://msdn.microsoft.com/en-us/library ... 85%29.aspx ("Virtual List-View Style") for further reference.
Today I looked how Windows Explorer (Win XP SP3) solves this problem. It does *not* use a virtual ListView. As I read further on MSDN some features of the ListView aren't available when using virtual ListViews. Such a feature is e.g. grouping.
Maybe that paragraph from MSDN (link posted in my previous answer) could be the solution:
Windows Explorer does exactly this when refreshing folder contents.
First it deletes all items using LVM_DELETEALLITEMS
Then it disables redrawing the ListView each time by sending a WM_SETREDRAW message.
Afterwards it inserts the items using LVM_INSERTITEMW. If you know how much items you will insert it may be a good idea to send a LVM_SETITEMCOUNT message before inserting items (Explorer doesn't do that).
Finally it enableds redrawing again by sending a WM_SETREDRAW message.
Maybe that paragraph from MSDN (link posted in my previous answer) could be the solution:
MSDN wrote:To add an item to a list-view control, use the LVM_INSERTITEM message, specifying the address of an LVITEM structure. Before adding multiple items, you can send the control an LVM_SETITEMCOUNT message, specifying the number of items the control will ultimately contain. This message enables the list-view control to reallocate its internal data structures only once rather than every time you add an item. You can determine the number of items in a list-view control by using the LVM_GETITEMCOUNT message. If you are adding a large number of items to a list-view control, you can speed up the process by disabling redrawing before adding the items, then enable redrawing after the items are added. Use the WM_SETREDRAW message to enable and disable redrawing.
Windows Explorer does exactly this when refreshing folder contents.
First it deletes all items using LVM_DELETEALLITEMS
Then it disables redrawing the ListView each time by sending a WM_SETREDRAW message.
Afterwards it inserts the items using LVM_INSERTITEMW. If you know how much items you will insert it may be a good idea to send a LVM_SETITEMCOUNT message before inserting items (Explorer doesn't do that).
Finally it enableds redrawing again by sending a WM_SETREDRAW message.
To avoid GUI choked when adding large number item in listview in an event (eg buttonclick). Im using Multithread. Place Dir listing and listview add item code in separate thread
ff is a dirlisting code itself
edit
oops dkl already mentioned that
Code: Select all
function IDD_DLG1_btFind_Clicked(Byval hWin as hwnd,Byval hCtrl as lparam)as long
If busy Then Return 0
pthrd=ThreadCreate(Cast(Any Ptr,@ff),hwin)
function=true
end function
ff is a dirlisting code itself
edit
oops dkl already mentioned that
Loe wrote:To avoid GUI choked when adding large number item in listview in an event (eg buttonclick). Im using Multithread. Place Dir listing and listview add item code in separate threadCode: Select all
function IDD_DLG1_btFind_Clicked(Byval hWin as hwnd,Byval hCtrl as lparam)as long
If busy Then Return 0
pthrd=ThreadCreate(Cast(Any Ptr,@ff),hwin)
function=true
end function
ff is a dirlisting code itself
edit
oops dkl already mentioned that
Thank you very much, but I already tried that. With this method we can not guarantee that everything will be stable during the rapid transition from folder to folder. I am on a day lost, but the result bad :(
The best probably is that the proposed St_W
Who is online
Users browsing this forum: No registered users and 4 guests