Important alert: (current site time 6/19/2013 2:31:51 AM EDT)
 

winzip icon

API-ucListView 1.0

Email
Submitted on: 9/4/2004 5:39:46 PM
By: Carles P.V. 
Level: Intermediate
User Rating: By 30 Users
Compatibility: VB 6.0
Views: 23973
 
     API-ListView usercontrol with most commom features (no dependencies -> thanks to Paul Caton for his great self-subclassing usercontrol template [CodeId=54117]). __________________________________________________ Notice: 1) Column, item and imagelist-icon indexing is zero-based. 2) Sorting: user should create a 'private' array for storing current column sort order (Ascending/Descending: 1/-1) -> Switch between sort order. 3) Items/SubItems do not allow custom font appearance (Bold, Color, etc). -> This needs custom-draw routines. 4) All properties are 'run-time properties'. __________________________________________________ Update 09/07: Added basic custom-draw support (for [Details] mode). Now, you can easily create a highlight effect (row and/or column). Enable RaiseSubItemPrePaint() and respond to OnSubItemPrePaint() event. __________________________________________________ Update 09/08: Custom-draw fix. Crash when XP theme enabled (Thanks to Dana Seaman). __________________________________________________ Update 12/09: Second and last fix for XP. __________________________________________________ Compatibility: in principle, all systems. // 33Kb zip.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 53 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
9/4/2004 8:04:15 PMLight Templer

Hi Carles,
really a fine project! Works with VB5, too (after two very small changes). But I have heavy flickering (redraw) when mouse moves over the uc. (Used OS: Win98SE) - Any ideas?
Regards and ***** LiTe
(If this comment was disrespectful, please report it.)

 
9/4/2004 8:29:28 PMThushan Fernando

No suprises another top quality post by Carles:-) Useful and lightweight... thanks:)
(If this comment was disrespectful, please report it.)

 
9/4/2004 8:34:48 PMCarles P.V.

Hi LiTe,
Sincerely: no :) ...Simply moving mouse over? Try commenting lines processing WM_MOUSEMOVE and WM_MOUSELEAVE messages, and let me know.
(If this comment was disrespectful, please report it.)

 
9/4/2004 8:41:19 PMCarles P.V.

Thanks Thushan. Anyway, initial work only had half number of lines. :)
(If this comment was disrespectful, please report it.)

 
9/4/2004 11:20:10 PMFred.cpp

hi charles. Nice to see another GREAT work.
Felicidades maestro, de verdad gran trabajo.
5 globes
(If this comment was disrespectful, please report it.)

 
9/5/2004 6:00:31 AMLight Templer

re Carles,
after some debugging:
In pvUCCoordScale() the two line
x = ScaleX(uPt.x, vbPixels, UserControl.ScaleMode)
y = ScaleY(uPt.y, vbPixels, UserControl.ScaleMode)
are producing the problem. Without them (and of course without the rest of 'Case WM_MOUSEMOVE to prevent an GPF ;)) the heavy redraw is gone. This scaling shouldn't raise a WM_PAINT or something like that ... (btw: Machine is 3 Ghz w fast videocard ;) )
Hope that helps - regards
LiTe
(If this comment was disrespectful, please report it.)

 
9/5/2004 7:20:28 AMCarles P.V.

Lite,
Strange that raising of a WM_PAINT. Examining messages, I wasn't be able to find any WM_[]PAINT. Only quick solution I see here is working with vbPixels, avoiding this way those (problematic?) ScaleXXX methods.
(If this comment was disrespectful, please report it.)

 
9/5/2004 11:48:47 AMNorm Cook

No flickering, NO problems, great work.
FIVE big ones.
(If this comment was disrespectful, please report it.)

 
9/7/2004 12:19:28 PMAnders Nissen

I can't wait to try this out, but it's currently not possible to download from PSC so I guess I have to :(
(If this comment was disrespectful, please report it.)

 
9/7/2004 12:30:51 PMCarles P.V.

Meanwhile, I can send zip. Simply, send me an email with next text: "Zip request". Thanks.
(If this comment was disrespectful, please report it.)

 
9/7/2004 1:36:29 PMPhantom Man

Hi Carles

Thanks For Sending The Zip.
Very Nice. 5 ***** Submission.

Regards
Gary



(If this comment was disrespectful, please report it.)

 
9/8/2004 4:16:25 AMDana Seaman_

Control crashes when ViewMode = LVS_REPORT and XP Themes are enabled. This happens both in the IDE via Vb6.Exe.Manifest or compiled with a Manifest file. I'm using XP-Pro/SP1. The VbAccelerator version does work with Themes enabled so it is probably something minor. 5 Globes for this excellent submission and another 5 if you fix the Theme bug.
(If this comment was disrespectful, please report it.)

 
9/8/2004 4:57:42 AMDana Seaman_

Finally was able to download your latest ZIP. In new Demo with .RaiseSubItemPrePaint = True everything works OK with XP Themes. If .RaiseSubItemPrePaint = False then it crashes. This should help narrow things down a bit.
(If this comment was disrespectful, please report it.)

 
9/8/2004 6:16:14 AMCarles P.V.

Thanks Dana. Yes, you are right. I've just tested it (same OS). It seems that when XP theme is enabled, the NM_CUSTOMDRAW notification message is waiting for, at least, the lReturn of CDDS_ITEMPREPAINT stage notification. (Zip updated)
(If this comment was disrespectful, please report it.)

 
9/9/2004 6:12:19 AMAnders Nissen

Exellent work as always Carles! Thanks for sending me the file when the download was corrupted. 5 stars is all that I'm allowed to give you.
(If this comment was disrespectful, please report it.)

 
9/19/2004 2:02:52 AMHeriberto Mantilla Santamaría

wow, very good work Carles, the control is very good.

5 globes from me.

If you speak Spanish you'll understand me this:

El control es excelente (ralla la perfección) lastima que la gente no lo ha valorado como se debe, cinco globos de parte mía y espero la gente le de la importancia que este control tiene.

Saludos desde Colombia.
(If this comment was disrespectful, please report it.)

 
9/29/2004 9:09:26 AM

Hi Carles

Very nice code as usual. I have a problem regarding user controls. Is there any way that I can contact you to tell you what it is about (the explanation of my problem would be rather long, and I haven't been able to send a message to you by clicking your name's link on this page)

Best Regards
Maximiliano
(If this comment was disrespectful, please report it.)

 
11/5/2004 11:12:36 PMRob Crombie

Hi,

I like the 'no dependencies' attitude, and will give 5 g's based on that, plus the obvious skill and time spent.

This appears to be approaching towards some of the features in VBAccelerator's SGrid-2

It can of course do other things, but here is a link to one of their examples using it in Listview mode -
http://www.vbaccelerator.com/home/VB/Code/Controls/S_Grid_2/ListView_Style_Grouping/ article.asp

Their
grid is very powerful, and they do provide examples. There is no help file as such, and there does not appear to be a lot of 'chatter' on the web, about it.
If others check it out, and start using it, perhaps they could suggest an existing VB (email) forum, where we could raise and answer questions ?

Rob Crombie
robhp@iprimus.com.au
(If this comment was disrespectful, please report it.)

 
11/5/2004 11:17:19 PMRob Crombie

PS

I forgot to mention the SGrid-2 is FREE

Rob Crombie
(If this comment was disrespectful, please report it.)

 
11/7/2004 10:34:25 AMPeter Hebels

Really nice code Carles, I've gave you a 5 for this! There was only one function that I missed: OLEDragDrop

I've written a quick solution for this problem, the code is in the following text file:

http://files.phserver.net/oledragdrop.txt
(If this comment was disrespectful, please report it.)

 
12/2/2004 3:13:01 PM

it carash for me...
(If this comment was disrespectful, please report it.)

 
12/9/2004 8:59:57 AM

It's very good!But it crash when I run it with XP SP2,why?
(If this comment was disrespectful, please report it.)

 
12/9/2004 9:43:05 AMCarles P.V.

Fixed.
(If this comment was disrespectful, please report it.)

 
12/19/2004 7:47:42 AM

It's very nice of you!
(If this comment was disrespectful, please report it.)

 
12/23/2004 9:41:20 PMZhu JinYong

VB crash in this updation.(WinXP SP1)
(If this comment was disrespectful, please report it.)

 
12/23/2004 9:43:20 PMZhu JinYong

VB crash When LV is on vmDetails mode.
(If this comment was disrespectful, please report it.)

 
12/24/2004 6:40:59 AMCarles P.V.

Are you sure you've downloaded last update?
(If this comment was disrespectful, please report it.)

 
12/25/2004 12:13:08 AMZhu JinYong

Yes.Latest file name is API-ucList1827331292004.zip.
(If this comment was disrespectful, please report it.)

 
1/11/2005 11:47:29 PM

Yes,I have the same bug!
I developed it under XP SP2,but carshed when I used XP SP1.
(If this comment was disrespectful, please report it.)

 
1/21/2005 2:56:37 AM

I'm sorry to have to tell you this...
But you still have som buges with theming and report...

By the way... the actual vailues for icon, smallicons, list and report are:
Icon - &H56800244
SmallIcon - &H56800246
List - &H56800247
Reoprt - &H56800245
(If this comment was disrespectful, please report it.)

 
2/5/2005 12:15:12 PM

It's very nice!
But little flicker occur while i fill its item, why?
OS£ºwindows2000 pro
Downloaded: API-ucList1827331292004.zip
(If this comment was disrespectful, please report it.)

 
3/4/2005 8:40:32 AMPaddyM

Very nice code, however, its crashing when i stop it in the vb ide
Windows 2000 sp4 (up to date)
Visual basic 6 sp6
any ideas?

(If this comment was disrespectful, please report it.)

 
5/13/2005 11:57:19 AMPablex

Carles, ita a great work! but it crashes when changes the sytle to report in xp (i try to create de listview in report mode and do the same)
thanks
keep your amazing work!
Pol.
(If this comment was disrespectful, please report it.)

 
8/27/2005 4:08:38 PM

Good Job! but it crashes when the view mode is report and form is shown (doesn't crash until the end of form load or until the form is shown)
(If this comment was disrespectful, please report it.)

 
10/16/2005 10:42:56 PMenmity

it seems that it only support integer(65535 items), if it exceeds 65525? how to support long?
(If this comment was disrespectful, please report it.)

 
11/8/2005 7:03:48 AMfrostbyte2k2

How can i force items to be checked ? using itemchecked property ? it doesn't work
(If this comment was disrespectful, please report it.)

 
12/20/2005 9:07:43 AMenmity

how to set background picture without using external file but from a StdPicture?
(If this comment was disrespectful, please report it.)

 
12/30/2005 7:04:10 AMRizwan Syed

Great Code Carles, You are the man!
(If this comment was disrespectful, please report it.)

 
9/21/2006 7:58:18 AMmisterN

Super code (5 *****) Deep respect for your sources. How to post images of files in this listview? Thank you in advance. One impassioned of vb of France…
(If this comment was disrespectful, please report it.)

 
10/5/2006 6:37:46 AMmisterN

How to store miniature images in this listview? Thank you in advance.
(If this comment was disrespectful, please report it.)

 
2/26/2007 6:38:08 AMManu

This is a good effort to make like this without any dependency.
(If this comment was disrespectful, please report it.)

 
9/17/2007 9:30:27 PMJason Newland

This is a great control. Only problem I noticed is, it works fine under XP with a manifest file for visual styles, but seems to crash in Vista with visual styles, yet all your other controls like the treeview & statusbar don't. Any ideas?
(If this comment was disrespectful, please report it.)

 
9/17/2007 9:31:40 PMJason Newland

Secondary note, when the style is set to columns with or without checkboxes with headers visible
(If this comment was disrespectful, please report it.)

 
10/22/2007 5:00:50 AMmaguire

Hi Carles, it's a good job.
Just one problem, when I stopped my project with stop button, it crashed and end the project and vb6, I want just to return to the code. I can't use 'end' in unload form.
Thanks.
(If this comment was disrespectful, please report it.)

 
6/13/2008 4:09:31 AMenmity

crash in vista with theme enabled, any idea?
(If this comment was disrespectful, please report it.)

 
10/20/2008 11:38:19 AMJason Newland

maguire: you're not supposed to use the End keyword anywhere in a visual basic app including a form's unload code for two reasons.
1) The form's Form_Terminate event never fires so VB never finishes doing its memory cleanup
2) The use of subclassing will also prevent you from pressing stop on IDE (this is not a practice you should ever do in the first place) and even tho Paul Caton's subclassing routine is supposed to prevent IDE crash, it doesn't always

Word of advice before running your program thru the IDE, always test compile it first, at least where subclassing is concerned, any error can be fixed before crashing the program. Hope this made sense :)
(If this comment was disrespectful, please report it.)

 
10/20/2008 11:39:58 AMJason Newland

And, Carles, I know you've probably stopped developing this but was wondering if you've fixed the Vista Theme/list header crash bug or know of a fix? Secondly, the list doesn't seem to support unicode properly or am I missing something?
(If this comment was disrespectful, please report it.)

 
11/7/2008 6:57:43 PMLorin

Quite excellent.
How about adding the much needed drag item to external like Windows Explorer?
As in the ListView Contains a Drive:Path\Filename as a "source" and we want to copy/move that with the drag destination being Windows Explorer. I know how to do this with a regular ListView on a form, but not with this usercontrol.

(If this comment was disrespectful, please report it.)

 
11/13/2008 5:57:04 PMEren Okka

Jason: You can set uLV as LVITEM_lp, pszText to StrPtr(Text), and use LVM_INSERTITEMW instead of LVM_INSERTITEM on ItemAdd() function for unicode support. I tested it with Japanese characters and it seems to work fine. LVM_INSERTITEMW equals (LVM_FIRST + 77) by the way.
(If this comment was disrespectful, please report it.)

 
3/25/2009 7:47:31 AMlittle_master

is there any way to remove that blue colour in detail view & use only white?
(If this comment was disrespectful, please report it.)

 
3/31/2009 11:55:19 AMEren Okka

That blue color comes from the custom-draw routine. You can either turn it off by removing RaiseSubItemPrePaint = True line in Form_Load, or edit ucListView1_OnSubItemPrePaint event anyway you like.
(If this comment was disrespectful, please report it.)

 
1/20/2010 4:57:31 PMbrandon

anyone figure out the mystery with vista/windows 7? Crashes for me too.. only when manifest is there.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.