listview control display as a group #2

I have a requirement to display the list items as group. I have been trying 
to use the CListCtrl::insertGroup() method. The method works fine but the 
grouping doesnt show it does show the items just as regular items.

Here is the code:

<html>

<head>
</head>

<body>

<font SIZE="2">
<font SIZE="2" COLOR="#0000ff">
<p>void</font><font SIZE="2"> Ctt1View::OnInitialUpdate()</p>
<p>{</p>
<blockquote>
  <p>CListView::OnInitialUpdate();</p>
</font>
<p></font><font SIZE="2" COLOR="#0000ff">this</font><font 
SIZE="2">->SendMessage(LVM_ENABLEGROUPVIEW,
1, 0);</p>
<p>LVGROUP lvg;</p>
<p>CStringW csGHead=L"Group1";</p>
<p>lvg.cbSize=</font><font SIZE="2" COLOR="#0000ff">sizeof</font><font 
SIZE="2">(LVGROUP);</p>
<p>lvg.cchFooter=0;</p>
<p>lvg.cchHeader=csGHead.GetLength();</p>
<p>lvg.iGroupId=0;</p>
<p>lvg.mask=LVGF_GROUPID|LVGF_HEADER|LVGF_ALIGN;</p>
<p>lvg.pszFooter=NULL;</p>
<p>lvg.pszHeader=csGHead.GetBuffer();</p>
<p>lvg.state=LVGS_NORMAL;</p>
<p>lvg.stateMask=0;</p>
<p>lvg.uAlign=LVGA_HEADER_CENTER;</p>
<p>long *lng=(long*)&lvg;</font></p>
<font SIZE="2">
<p><font color="#0000FF">this</font>->SendMessage(LVM_INSERTGROUP, 0, 
(LPARAM)lng);</font></p>
<font SIZE="2">
<p>csGHead=L"Group2";</p>
<p>lvg.cbSize=</font><font SIZE="2" COLOR="#0000ff">sizeof</font><font 
SIZE="2">(LVGROUP);</p>
<p>lvg.cchFooter=0;</p>
<p>lvg.cchHeader=csGHead.GetLength();</p>
<p>lvg.iGroupId=1;</p>
<p>lvg.mask=LVGF_GROUPID|LVGF_HEADER|LVGF_ALIGN;</p>
<p>lvg.pszFooter=NULL;</p>
<p>lvg.pszHeader=csGHead.GetBuffer();</p>
<p>lvg.state=LVGS_NORMAL;</p>
<p>lvg.stateMask=0;</p>
<p>lvg.uAlign=LVGA_HEADER_CENTER;</p>
<p></font><font SIZE="2">lng=(long*)&lvg;</font></p>
<font SIZE="2">
<p><font color="#0000FF">this</font>->SendMessage(LVM_INSERTGROUP, 1, 
(LPARAM)lng);</font></p>
<font SIZE="2">
<p></font><font SIZE="2">if(<font 
color="#0000FF">this</font>->GetListCtrl().IsGroupViewEnabled())</font></p>
<font SIZE="2">
<p> AfxMessageBox(" Group View Enabled", MB_OK);</font></p>
<font SIZE="2">
<p></font><font SIZE="2" COLOR="#0000ff">this</font><font 
SIZE="2">->SendMessage(LVM_ENABLEGROUPVIEW,
1, 0);</p>
<p>CString csItem="Item1";</p>
<p>LVITEM lvi;</p>
<p>lvi.cchTextMax=csItem.GetLength();</p>
<p>lvi.cColumns=0;</p>
<p>lvi.iGroupId=0;</p>
<p>lvi.iImage=0;</p>
<p>lvi.iIndent=0;</p>
<p>lvi.iItem=0;</p>
<p>lvi.iSubItem=0;</p>
<p>lvi.lParam=NULL;</p>
<p>lvi.mask=LVIF_TEXT|LVIF_GROUPID;</p>
<p>lvi.pszText=csItem.GetBuffer();</p>
<p>lvi.puColumns=0;</p>
<p>lvi.state=LVIS_OVERLAYMASK|LVIS_SELECTED;</p>
<p>lvi.stateMask=LVIS_SELECTED;</p>
<p></font><font SIZE="2" COLOR="#0000ff">long</font><font SIZE="2"> 
*lit=(</font><font SIZE="2" COLOR="#0000ff">long</font><font 
SIZE="2">*)&lvi;</p>
<p></font><font SIZE="2" COLOR="#0000ff">this</font><font 
SIZE="2">->SendMessage(LVM_INSERTITEM,
0, (LPARAM)lit);</p>
<p>csItem="Item2";</p>
<p>lvi.cchTextMax=csItem.GetLength();</p>
<p>lvi.cColumns=0;</p>
<p>lvi.iGroupId=0;</p>
<p>lvi.iImage=0;</p>
<p>lvi.iIndent=0;</p>
<p>lvi.iItem=1;</p>
<p>lvi.iSubItem=0;</p>
<p>lvi.lParam=NULL;</p>
<p>lvi.mask=LVIF_TEXT|LVIF_GROUPID;</p>
<p>lvi.pszText=csItem.GetBuffer();</p>
<p>lvi.puColumns=0;</p>
<p>lvi.state=LVIS_OVERLAYMASK|LVIS_SELECTED;</p>
<p>lvi.stateMask=LVIS_SELECTED;</p>
<p>lit=(</font><font SIZE="2" COLOR="#0000ff">long</font><font 
SIZE="2">*)&lvi;</p>
<p></font><font SIZE="2" COLOR="#0000ff">this</font><font 
SIZE="2">->SendMessage(LVM_INSERTITEM,
0, (LPARAM)lit);</p>
<p>csItem="Item3";</p>
<p>lvi.cchTextMax=csItem.GetLength();</p>
<p>lvi.cColumns=0;</p>
<p>lvi.iGroupId=0;</p>
<p>lvi.iImage=0;</p>
<p>lvi.iIndent=0;</p>
<p>lvi.iItem=2;</p>
<p>lvi.iSubItem=0;</p>
<p>lvi.lParam=NULL;</p>
<p>lvi.mask=LVIF_TEXT|LVIF_GROUPID;</p>
<p>lvi.pszText=csItem.GetBuffer();</p>
<p>lvi.puColumns=0;</p>
<p>lvi.state=LVIS_OVERLAYMASK|LVIS_SELECTED;</p>
<p>lvi.stateMask=LVIS_SELECTED;</p>
<p>lit=(</font><font SIZE="2" COLOR="#0000ff">long</font><font 
SIZE="2">*)&lvi;</p>
<p></font><font SIZE="2" COLOR="#0000ff">this</font><font 
SIZE="2">->SendMessage(LVM_INSERTITEM,
0, (LPARAM)lit);</p>
<p>csItem="Item11";</p>
<p>lvi.cchTextMax=csItem.GetLength();</p>
<p>lvi.cColumns=0;</p>
<p>lvi.iGroupId=1;</p>
<p>lvi.iImage=0;</p>
<p>lvi.iIndent=0;</p>
<p>lvi.iItem=0;</p>
<p>lvi.iSubItem=0;</p>
<p>lvi.lParam=NULL;</p>
<p>lvi.mask=LVIF_TEXT|LVIF_GROUPID;</p>
<p>lvi.pszText=csItem.GetBuffer();</p>
<p>lvi.puColumns=0;</p>
<p>lvi.state=LVIS_OVERLAYMASK|LVIS_SELECTED;</p>
<p>lvi.stateMask=LVIS_SELECTED;</p>
<p>lit=(</font><font SIZE="2" COLOR="#0000ff">long</font><font 
SIZE="2">*)&lvi;</p>
<p></font><font SIZE="2" COLOR="#0000ff">this</font><font 
SIZE="2">->SendMessage(LVM_INSERTITEM,
0, (LPARAM)lit);</p>
<p>csItem="Item12";</p>
<p>lvi.cchTextMax=csItem.GetLength();</p>
<p>lvi.cColumns=0;</p>
<p>lvi.iGroupId=1;</p>
<p>lvi.iImage=0;</p>
<p>lvi.iIndent=0;</p>
<p>lvi.iItem=1;</p>
<p>lvi.iSubItem=0;</p>
<p>lvi.lParam=NULL;</p>
<p>lvi.mask=LVIF_TEXT|LVIF_GROUPID;</p>
<p>lvi.pszText=csItem.GetBuffer();</p>
<p>lvi.puColumns=0;</p>
<p>lvi.state=LVIS_OVERLAYMASK|LVIS_SELECTED;</p>
<p>lvi.stateMask=LVIS_SELECTED;</p>
<p>lit=(</font><font SIZE="2" COLOR="#0000ff">long</font><font 
SIZE="2">*)&lvi;</p>
<p></font><font SIZE="2" COLOR="#0000ff">this</font><font 
SIZE="2">->SendMessage(LVM_INSERTITEM,
0, (LPARAM)lit);</p>
<p>csItem="Item13";</p>
<p>lvi.cchTextMax=csItem.GetLength();</p>
<p>lvi.cColumns=0;</p>
<p>lvi.iGroupId=1;</p>
<p>lvi.iImage=0;</p>
<p>lvi.iIndent=0;</p>
<p>lvi.iItem=2;</p>
<p>lvi.iSubItem=0;</p>
<p>lvi.lParam=NULL;</p>
<p>lvi.mask=LVIF_TEXT|LVIF_GROUPID;</p>
<p>lvi.pszText=csItem.GetBuffer();</p>
<p>lvi.puColumns=0;</p>
<p>lvi.state=LVIS_OVERLAYMASK|LVIS_SELECTED;</p>
<p>lvi.stateMask=LVIS_SELECTED;</p>
<p>lit=(</font><font SIZE="2" COLOR="#0000ff">long</font><font 
SIZE="2">*)&lvi;</p>
<p></font><font SIZE="2" COLOR="#0000ff">this</font><font 
SIZE="2">->SendMessage(LVM_INSERTITEM,
0, (LPARAM)lit);</p>
<p></font><font SIZE="2" COLOR="#0000ff">this</font><font 
SIZE="2">->SendMessage(LVM_ENABLEGROUPVIEW,
1, 0);</p>
</blockquote>
</font>

<p><font size="2">}</font></p>

</body>

</html>


0
vcpp1 (3)
6/17/2005 8:32:14 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
398 Views

Similar Articles

[PageSpeed] 30

Reply:

Similar Artilces:

spreadsheet formula #2
Good morning, i have a manager who wants to average a set of cells. he there are indefinate number of cells in a row and he wants to average only the current entry plus only the last three consecitive entries. example: if a1,b1,c1,d1,f1 all have entries he wants the average based on the info in b1,c1,d1,f1. when e1 has data entered he wants the average to be based on c1,d1,f1,e1. there are 20+ rows that need to have this function. can someone help, this is beyond my capabilities. thanks doug Doug, This will total it for row 1 =SUM(N(OFFSET(A1,,LARGE((1:1<>"")*(COLUMN(I...

2003 to 2004 #2
I have money 2003 now if I get money 2004 will all the info form 2003 transfer to 2004? yes..... >-----Original Message----- >I have money 2003 now if I get money 2004 will all the >info form 2003 transfer to 2004? >. > Provided you are in the same region i.e. US > US or UK > UK. -- Regards Bob Peel, Microsoft MVP - Money Hints/Tips http://support.microsoft.com/default.aspx?scid=fh;EN-GB;mny UK Wishes/Suggestions mnyukwsh@microsoft.com "Brian" <anonymous@discussions.microsoft.com> wrote in message news:006501c3dc4e$933e2870$a301280a@ph...

ADC Replication #2
A couple of days ago while my servers were replicating via ADC our T-1 went down. When the connection came back up the a diabled copy of every users was created in AD with mail enabled. When users tried to log into their email Outlook said their email mailbox could not be found. I got that fixed but, now the GAL on our 5.5 servers is routing email to the wrong email address for every user on our Exchange 2000 machine. Anyone have any idea how to clean this up. Should I export the GAL, manually edit each user and re-import the CSV file or is their an easier way? We are running a mixe...

User Level Security
Hi, I've just implemented the User Security and would like to setup one of the users with the ability to add and modify other users permisssions but not have admin access to the database. Ideally I want to add a button to my Main Menu form that would allow them to open the built in Access "User and Group Accounts ..." form. Is this a doable thing? Thanks, Ken ...

Can't view files with latest beta2 refresh #2
I downloaded the latest Beta2 refresh and now I cant access any of my word and publisher docs. It says "can't find file" or some such thing. I thought I read somewhere that the view and print functions in the latest refresh have been disabled. This is MOST inconvenient as every piece of business on my hard drive is now useless....is there any way of fixing this? Yes, you've said that already. -- JoAnn Paules MVP Microsoft [Publisher] "Fabman" <Fabman@discussions.microsoft.com> wrote in message news:D9FD0DA9-F0DF-4CFF-ACB9-8207333DEBE7@microsoft.co...

Pivot Table Error: Cannot group that selection
Hello I'm trying to group invoice dates in a pivot table by month and year. Too bad there is no "reason" button? heheh Any suggestions are greatly appreciated Sherron You'll see that message if there are text entries or blank cells in the column of dates. anonymous@discussions.microsoft.com wrote: > I'm trying to group invoice dates in a pivot table by > month and year. Too bad there is no "reason" button? heheh -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html Thankyou... but I've checked that all d...

VB
I have a query which displays contents in a grid. The SourceObject Property is "Query.qry-ShowData". How can I return the actual SQL statement used by this query? The reason is this query pulls contents from different forms to create the WHERE statement and I would like to see the actual SQL statement used by the "Query.qry-ShowData". Thank you in advance for your help. Mike Hi, try: debug.print currentdb.querydefs("qry-ShowData").SQL -- Best regards, ___________ Alex Dybenko (MVP) http://accessblog.net http://www.PointLtd.com "Michael Kintne...

Tab to an ActiveX control?
Hi. Does anyone know how to tab to an ActiveX control? I can get it to tab to the cell where the control is, but not the control itself. How about an ActiveX control that is in a protected cell? Thanks for your help. -- Karin ...

unaccepted transactions not displaying
I'm using Money 2007 Deluxe on Vista RTM. On Friday I downloaded my transactions as usual but when I went to my accounts there were no "unaccepted" tranactions to accept. My system shows a mismatch in balance due to these transactions, but I can't find them anywhere. The system knows they are there because my accounts list "Transactions to to read: x", but when I click on the link there is nothing displayed. Any thoughts? Thanks! JJ In microsoft.public.money, JJ Streicher-Bremer wrote: >I'm using Money 2007 Deluxe on Vista RTM. On Friday I down...

Moving a contact group from Outlook Express 6 to Outlook?
I have a large contact group that is making my Outlook Express address book to cluttered (I use Outlook Express more often than Outlook) and would like to know if there is any easy way to just move it to Outlook without having to retype all the names and addresses? Thanks, Mark No, since Outlook does not use or support groups in the way that OE does. You need to state your Outlook version and tell us whether the members of the OE group also exist in the Contacts folder or only in the group. -- Russ Valentine [MVP-Outlook] "Mark B." <somno@earthlink.net> wrote in message ...

Slow start up times... #2
Word, Excel & PowerPoint, all display the same issue and although Entourage doesn't appear to have it, it does load up slow. Here is the issue: When opening the apps, the apps load fast enough, BUT ARE NOT ready for imput for about 5 seconds after you see the empty document. So I have to wait and wait until either I can type in Word or Click on any of the cells in Excel. The same happens in PowerPoint where I can't start to do anything. I have a Menu Meters installed and I can see the two CPUS going pretty high while this is happening. All together it takes Excel 15 seconds...

How to align the bottom lines of 2-column pages?
I have compiled a bi-lingual dictionary (left to right and right to left) using Word 2007; with the result that the bottom lines of a 2-column page cannot be aligned; understandably so. Now, I want to import the documents to Microsoft Publisher 2007, where I know that aligning those bottom lines together can be done - but how? Any help offered will be much appreciated! How are you planning to export the text from Word? How many columns per page? Will your dictionary be in booklet form? Are your definitions in two different Word files? -- Mary Sauer http://msauer.mvps.or...

Uninstalling Office 2004 #2
We purchased 3 office licenses. And I installed one on my mac (intel-based), accidentally using the same key code that has been used to install office on another mac. So I uninstalled office on my machine and then tried to install again but this time the set-up wizard didn't even ask for a key code and proceeded to install office with the same key code perhaps because my machine has the previous information stored in its system somewhere even though I had uninstalled it. Does anyone know how I can completely uninstall office and install it with a new key code? Thanks for your help! Hi...

Require Sales Force Automation (SFA) Software #2
We are basically a Logistics company and looking for SFA(Sales Force Automation Software)through which our sales team can co-ordinate with each other and update the database from different places also view more information http://www.fibre2fashion.com/software-solutions/knowmore.aspx?inquiryid=462. ...

Activex control
I have an Activex control which exposes multiple interfaces for example, ISample1 – CSample1 (Coclass) ISample2 – CSample2 (Coclass) I need to add new methods/properties (a new version). Since ISample1 and ISample2 cannot be modified, I’ll have two new interfaces, ISample1Ext ISample2Ext These will be a replication of ISample1 and ISample2, but with new methods/properties added. The old interfaces will be marked deprecated and may be removed in future. The question is, 1. Do I have to copy all the implementation from CSample1 and CSample2 to CSample1Ext and CSample2Ext? 2. If thi...

How to control chart properties from worksheet
Hello experts! Is it possible to control the chart properties from the worksheet? I know it is possible to control legend texts (series names). I am especially interested in controlling the ranges of series. How to control the title and other texts on the chart would be also useful. Best regards, Marko Marko - You can control the length of the series by creating dynamic ranges and using these as the data range for each series. See the examples and links here: http://peltiertech.com/Excel/Charts/Dynamics.html You can link a chart text element to a worksheet cell easily. Select the...

Display decimal with multiplier
I have a several rows of data that I display on a chart. Now one row of data is in decimal like so 0.001. The data displays just like I want and I cannot change the source of the data nor can I read it from anywhere else. Now my problem is when I put a data label on my chart the textbox shows up on each point with the value 0.001. I would like to display the value as a multiple of the real data value so that it shows up as 1. I looked in the help and see that you can use a format of "#," to display a number but that is lowering the number as in 12,000 gets displayed as 12. I just can...

Collection Letters #2
I have been reading the contributions regarding the Letter Writing Assistant and the Collections letters. I would like to add my voice to the opinion that we should be able to modify fields a little easier. The faculity of the letters are convenient and vital to the collection process. We are at Ver. 8.0, going to 10.0 by the end of year I hope things have gotten less complicated. ...

Outlook not closing #2
Outlook was closed last night but the screen is still showing the 'please wait while microsoft outlook exits' box. Does anyone know why this is happening? Are you running anything that might keep Outlook running (like a fax module)? "John A" <anonymous@discussions.microsoft.com> wrote in message news:04f301c3a9e4$5d70b150$a001280a@phx.gbl... > Outlook was closed last night but the screen is still > showing the 'please wait while microsoft outlook exits' > box. Does anyone know why this is happening? No there is nothing running that would keep i...

Outlook
Please let me know the steps to create a script to show under the "Rules and allerts" tool manu. Thanks Have you tried clicking "New Rule?" :-) -- -Ben- Ben M. Schorr, MVP Roland Schorr & Tower http://www.rolandschorr.com http://www.officeforlawyers.com "Test" <test@any.com> wrote in message news:uhyywXW0IHA.5832@TK2MSFTNGP02.phx.gbl: > Please let me know the steps to create a script to show under the "Rules and > allerts" tool manu. > > Thanks try the outlook.programming newsgroup or outlookcode.com. -- Diane Porem...

how to convert mail to task? #2
hi everyone, i wonder if someone knows how can i make a mcro that will convert mai (from specific folder) to a task? i have a folder in my outlook that every mail there i convert to tas by draging the mail (using the right click) to the task folder an choosing the "Copy Here as Task with Attachment" option - as you ca see in the attach pic i want to make this action automatic. 10x for your time eligr +---------------------------------------------------------------- | Attachment filename: !test.jpg |Download attachment: http://www.outloo...

Microsoft CRM 1.2 database export failed 04-04-06
This message comes from the Microsoft CRM Server Setup. The crm30svrsetup.log has error - 14:36:41| Error| Check ExportXmlValidator : Failure: Microsoft CRM 1.2 database export failed. When you press help I get a "Mal-formed XML found in Microsoft CRM 1.2 Exported Saved Queries" which explains nothing! Somebody else must have a similar error! ......... Bob H Hi Bob, We had this with a customer. We ended up un-installing MS CRM 1.2 and running MS CRM 3 install by simply connecting to the 1.2 db's. However, we ran a series of scripts against the CRM db's (before 3 se...

Serial number display
Serial numbers on transaction screens (Inventory adjustment, Inventory transfer, Sales Order fulfillment, etc.) should be displayed in serial number sequence. It is extremely cumbersome to scroll through serial numbers as is when they are displayed by date entered, rather than by serial number. Also once you find and select a serial number the cursor should move to the next serial number in sequence, not back to the start of the list. -- Jim@TurboChef ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for t...

Cannot display the folder. Microsoft Office Outlook cannot access the specified folder location.
Outlook 07 stopped responding (Vista) and I tried to run scanpst.exe but it wouldn't run because it thought Outlook was still running. I ended the process in Task Manager and still got the running message. Have then rebooted and again tried to run scanpst but it still thinks the file is in use. Now I'm stumped. How can I restore my pst file in Outlook? Thanks in advance, B Try these ideas: http://www.slipstick.com/problems/scanpst.asp "Boppy" <therealboppy@yahoo.com> wrote in message news:edf7fe02-44b1-4e68-9d24-5ed66e75ea4e@i29g2000prf.googlegroups.com... > Ou...

Key for pos in rms 2.0
Hi all, my name is Scilla. I from Italy I have download the version 2.0 of RMS and when i open POS ask me a key. Where i can find a key for 30 days evalution for use the POS? Thank you so much. Reply on email o by msn. msn: missdata@hotmail.com Scilla ...