Windows programming

Moderators: None (Apply to moderate this forum)
Number of threads: 3711
Number of posts: 9173

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
New Windows control Posted by Lican on 23 Jan 2005 at 12:59 PM
Hello,

Recently I started ( first it was just for fun ) a quite intereting project. I have always used windows' list view control with the LVS_REPORT style. But I found it not good enough to satisfy my demands. So I wrote my own control from scratch. It look just like the original, works the same, but has some new features. One of them is hiding a column. I cannot count how many times I needed something like that and just couldn't get any help how to do that from the internet. I also provided a standard dialog for editing column's name, align etc. and a dialog for editing items. If anyone is interested in the project or has any suggestions please write to me, I would be very pleased to anwser any e-mails: lican@wp.pl

My control is using RegisterClass with CS_GLOBALCLASS and CS_PARENTDC so once the DLL with the control is loaded any program can use it and the control draws on the parent DC. It uses it's own class for data storing, has all the advantages and non of the drawbacks of a list view control. For testing I override new and delete functions to check if there are no memory leaks and so far it's doing great. For any details contact me :)

Soon the project will be finished... :D
Report
Re: New Windows control Posted by AsmGuru62 on 23 Jan 2005 at 2:45 PM
: Hello,
:
: Recently I started ( first it was just for fun ) a quite intereting project. I have always used windows' list view control with the LVS_REPORT style. But I found it not good enough to satisfy my demands. So I wrote my own control from scratch. It look just like the original, works the same, but has some new features. One of them is hiding a column. I cannot count how many times I needed something like that and just couldn't get any help how to do that from the internet. I also provided a standard dialog for editing column's name, align etc. and a dialog for editing items. If anyone is interested in the project or has any suggestions please write to me, I would be very pleased to anwser any e-mails: lican@wp.pl
:
: My control is using RegisterClass with CS_GLOBALCLASS and CS_PARENTDC so once the DLL with the control is loaded any program can use it and the control draws on the parent DC. It uses it's own class for data storing, has all the advantages and non of the drawbacks of a list view control. For testing I override new and delete functions to check if there are no memory leaks and so far it's doing great. For any details contact me :)
:
: Soon the project will be finished... :D
:
Also, my advice is to test it for large item count. I tried the standard list view on about 40,000 items - looks OK, not very slow... but noticeable.
Report
Re: New Windows control Posted by Lican on 24 Jan 2005 at 6:27 AM
: Also, my advice is to test it for large item count. I tried the standard list view on about 40,000 items - looks OK, not very slow... but noticeable.

I've checked that too :) For 100.000 items it was quite fast on P 400Mhz :P And as for drawing that was checked too. Adding items when a column is sorting is much worse, but I'm working on it. Thanks anyway for your advice :)

Report
Re: New Windows control Posted by AsmGuru62 on 25 Jan 2005 at 5:22 AM
: : Also, my advice is to test it for large item count. I tried the standard list view on about 40,000 items - looks OK, not very slow... but noticeable.
:
: I've checked that too :) For 100.000 items it was quite fast on P 400Mhz :P And as for drawing that was checked too. Adding items when a column is sorting is much worse, but I'm working on it. Thanks anyway for your advice :)
:
:
Make a mode for adding a lot of items, so you do not draw for every item:
MyListView lv;

lv.BeginFillItems (); // Apply non-drawing mode

for (int i=0; i<10000; i++) {
  lv.AddItem (...);
}

lv.EndFillItems (); // Apply drawing mode back and refresh in full

I once had interesting experience: replacing strcmp() with my own code gave me almost 4 times speed up in sorting.

Report
Re: New Windows control Posted by Lican on 25 Jan 2005 at 9:45 AM
: Make a mode for adding a lot of items, so you do not draw for every item:
:
: MyListView lv;
: 
: lv.BeginFillItems (); // Apply non-drawing mode
: 
: for (int i=0; i<10000; i++) {
:   lv.AddItem (...);
: }
: 
: lv.EndFillItems (); // Apply drawing mode back and refresh in full
: 

: I once had interesting experience: replacing strcmp() with my own code gave me almost 4 times speed up in sorting.
:


Well, if you're adding items beyond the visible lines the control will not redraw its contents. But this idea is great. I'll try to use that too. Thanks :) As for adding a lot of items the list has a message LLM_SETITEMCOUNT which will reserve extra memory.

I once read an article that took up the subject of comparing strings. From what I know it's best to compare the first letters and if their equal do anything you need to do. E.g. :

int result=str1[0]-str2[0];
if( result == 0 )
   return CompareStr(...);
else
   if( result > 0 )
       return FirstGreater;
   else
       return SecodGreater;


That saves about 33% time because it doesn't have to use "call" instruction. This method would not work for non-ascii letters, for example in my language ( polish :) this is not enough. But I'm still working on it...
Report
Re: New Windows control Posted by AsmGuru62 on 26 Jan 2005 at 5:20 AM
: : Make a mode for adding a lot of items, so you do not draw for every item:
: :
: : MyListView lv;
: : 
: : lv.BeginFillItems (); // Apply non-drawing mode
: : 
: : for (int i=0; i<10000; i++) {
: :   lv.AddItem (...);
: : }
: : 
: : lv.EndFillItems (); // Apply drawing mode back and refresh in full
: : 

: : I once had interesting experience: replacing strcmp() with my own code gave me almost 4 times speed up in sorting.
: :

:
: Well, if you're adding items beyond the visible lines the control will not redraw its contents. But this idea is great. I'll try to use that too. Thanks :) As for adding a lot of items the list has a message LLM_SETITEMCOUNT which will reserve extra memory.
:
: I once read an article that took up the subject of comparing strings. From what I know it's best to compare the first letters and if their equal do anything you need to do. E.g. :
:
:
: int result=str1[0]-str2[0];
: if( result == 0 )
:    return CompareStr(...);
: else
:    if( result > 0 )
:        return FirstGreater;
:    else
:        return SecodGreater;
: 

:
: That saves about 33% time because it doesn't have to use "call" instruction. This method would not work for non-ascii letters, for example in my language ( polish :) this is not enough. But I'm still working on it...
:
Great stuff!
Report
Re: New Windows control Posted by Lican on 26 Jan 2005 at 1:39 PM
: Great stuff!

Thanks! And thank you again!! I included the "no draw" function to disable the drawing, and it disables sorting also so that it would not sort after every extra item. I noticed that adding items is faster if they are added at the end if the list ( no memory moving needed ). I also improved inserting items as if the control is sorting, they do not have to be have any fixed position so they are added at the end... I had to double check the drawing functions. And as usual there were some mistakes :) But everything is under control now. The only thing I hate about writing any code is the GUI ;) It's horrible! But I'm disappointed too ( or maybe very happy :) ) that only one person showed some interest in what I'm doing. Maybe the effort will pay off :D Soon I'll make a help file for the control. The only thing left is to put it into the DLL... Interested?
Report
Re: New Windows control Posted by AsmGuru62 on 27 Jan 2005 at 5:07 AM
: : Great stuff!
:
: Thanks! And thank you again!! I included the "no draw" function to disable the drawing, and it disables sorting also so that it would not sort after every extra item. I noticed that adding items is faster if they are added at the end if the list ( no memory moving needed ). I also improved inserting items as if the control is sorting, they do not have to be have any fixed position so they are added at the end... I had to double check the drawing functions. And as usual there were some mistakes :) But everything is under control now. The only thing I hate about writing any code is the GUI ;) It's horrible! But I'm disappointed too ( or maybe very happy :) ) that only one person showed some interest in what I'm doing. Maybe the effort will pay off :D Soon I'll make a help file for the control. The only thing left is to put it into the DLL... Interested?
:
It is easy to put it into DLL. Just register the class as global in DllMain() and unregister in the same function - there are different cases for that.

I have my own ListView written in ASM, so, basically, I am using mine. But I can try yours, just send me that DLL. (asmguru62@hotmail.com)




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.