CListCtrl::HitTest reports Items under header bar


When I do a HitTest() from within OnDragOver() there are several things
that make no sense.

1) When I drag a file over the column headers in LVS_REPORT style,
HitTest() reports real list items that are hidden under the header bar,
rather than -1. When the list is scrolled to the top, it reports Item 0
as being under the header making its hit area twice as big as other

2) When I return DROPEFFECT_NONE from OnDragOver() I get the copy plus
  OH! I found this one, I had DragAcceptFiles(TRUE) in OnCreate().
  So, This one is fixed by removing it. (Left here for other readers.)

3) I never see LVHT_ABOVE or LVHT_TOLEFT in any of the view styles.
Dragging over the header should give me LVHT_ABOVE. Right?

4) SubItem is always zero. Why?

What am I doing wrong?



Some of my code here:

BOOL CDCWApp::InitInstance()
	BOOL bR = AfxOleInit(); // Initialization for Drag and Drop

// ... <more stuff>
} // end CDCWApp::InitInstance()


int CFileListView::OnCreate(LPCREATESTRUCT lpCreateStruct)
	if (CMultiColumnSortListView::OnCreate(lpCreateStruct) == -1)
		return -1;
	BOOL bR = dropLT.Register(this);
//	DragAcceptFiles(TRUE); // This was making the copy + appear wrongly
	return 0;

DROPEFFECT CFileListView::OnDragOver(COleDataObject* pDataObject, DWORD
dwKeyState, CPoint point)
	CListCtrl &rLC=GetListCtrl();
	// Here (for testing) I use both forms of HitTest()
	//  and compare the results
	//  - always the same as expected. (Both strange.)
	// case 1
	UINT ht1;
	int x = rLC.HitTest(point,&ht1);
	// case 2
	LVHITTESTINFO ht2; = point;
	ht2.flags = 0;
	ht2.iItem = 0;
	ht2.iSubItem = 0;
	int xx = rLC.HitTest( &ht2 );
	ASSERT(x == xx);
	ASSERT( == point.x && == point.y);
	ASSERT(ht2.flags == ht1);
	ASSERT(ht2.iItem == x);
	TRACE("CFileListView::OnDragOver pt=%3d %3d x=%2d ht=%2x si=%d\n",
		point, x, ht1, ht2.iSubItem);
	// SubItem is always 0, for LVS_EX_FULLROWSELECT or not
	if(x == -1)
		return DROPEFFECT_NONE; // Doesn't work
	return DROPEFFECT_MOVE; // Just testing
} // end (CFileListView::OnDragOver()

harveyab (125)
4/6/2006 8:59:52 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 12

I solved the SubItem problem with:
	int x3 = rLC.SubItemHitTest(&ht2);
So that leaves problem 1 and 3

Any help on these would be appreciated

harveyab (125)
4/6/2006 5:50:06 PM

Similar Artilces:

reports #3
Hi i want to do a report in rms that would show a price list of item's that are in say one supplier and only in certain departments for example Supplier = Adidas Department = Mens Department = Womens Department = Childrens Tom, Doesn't this work; Supplier = Adidas .AND. Department = Mens .OR. Department = Womens .OR. Department = Childrens -- * Get Secure! - You must be using Outlook Express or some other type of newsgroup reader to see and download the file attachment. If you are not using a reader, follow the link below to setup Outlook Express....

cant print reports after moving database.
i moved great plains databases from one server to another. i changed the ODBC drivers and map share to dynshare on clients machine. we can log on, get to the databases fine, look at data, but when you want to print a report to screen it comes up with " not able to access sql data". you click ok and you see the report, but no data. any ideas? thanks. ...

Pull report values in VBA
I have a list of fields that I'm pulling in to my report. Basically values for Jan - Dec. For each month I would like to conditionally format the back color depending on the value each month. Conditonal formatting in Access 07 only seems to allow 3 conditionals. I need more. I figured why not code it on the form open command. Is this doable? I thought I could do something along the lines of: If Me!Jan.Value >= 90 Then Me!Jan.BackColor = "#224422" Else If Me!Jan.Value < 90 Then Me!Jan.BackColor = "#220011" End If End If Whenever I try to pre...

Built-In Reporting
Are there any built-in reports within Exchange 2K3? I'm trying to determine things like: > Who's the biggest user of email > How many internal / external messages have been processed, etc. Thanks, Enrique Not really. NetIQ has some of this in their App Manager / App Analyser Suite, and if you are running a small shop, take a look at -- regards, Michael Abbaticchio MVP for Microsoft Exchange Server "Enrique" <> wrote in message news:uB%23f8O9uEHA.4028@TK2MSFTNGP15.phx.gbl... > A...

Money 2004 problem with duplicate budget item
I'm not sure when this happened, but it has occurred sometime since after I upgraded to Money 2004 (from Money 98). I have a Direct Debit "scheduled bill" setup for a loan payment against my home. For some reason, this loan payment shows up as double the loan payment when I run my "How am I doing on my Budget" report. However, when I edit the budget, it only shows up once. I had removed and readded the scheduled payment of the loan to try to correct another problem I was having. Any help you can give would be great. Thanks, Ken I have the exact same prob...

Change bars color
Hello, I have a dinamic chart to show the cash flow position, a scrool bar chagne the data to the past and to the future (estimate), what I am looking for is, to have an easy identification of the estimated period I would like to chage the color of the bar. I am using an Stacked Column chart with two variables. any Ideias? -- regards from Brazil Thanks in advance for your feedback. Marcelo What I usually do when I want to show a column chart with one color within a certain range and another color elsewhere, is create two series, one each color, and use formulas to change on series ...

eXtender and Crystal Reports
I've created a Crystal Report to print eOne solutions eXtender fields. They store inaformation in 4 different tables: EXT00101 (String), EXT00102(Numbers), EXT00103(Date),EXT00104(Time).. I have created a View that unions all these tables - and convert them into a Varchar.. Once that is done, I've created a function called GetExtFieldValue where i pass the extender window id and field number and it returns the value for that string. This report was working fine and all of a sudden it became so slow that now it takes 7 minutes to get one record. If I delete all the data from EXT...

Can't Delete, Can't move items and can't send/receive
My outlook had to be terminated due to a hangup. When I restarted outlook, it had to rebuild the database. After this occured, when I try to erace an e-mail, I get in error message stating "messaging interface has returned an unknown error. If problem presists, restart Outlook." When I try to move an e-mail I get an error message stating "Can't Move Item". When my outlook does a send and receive I get the following error message "Unkown Error 0x8004060C". Can anyone help?!?!?! ...

CListCtrl Header height change??
CListCtrl Header height change?? Is it possible to change the height of a CListCtrl Header.? Thanks Markus ...

CRM 3.0 allow custom reports?
hello, my question is... if CRM 3.0 allow create new reports, or just works with the default system. where i go to do this? CRM 3.0 uses SQL Reporting Services to provide reports to the application. If you are interested in writing custom reports I suggest you consult the CRM 3.0 SDK for instructions on how to do so. Also consult Microsoft for instructions on how to develop reports for Reporting Services. Derek "Miguel" <> wrote in message > hello, my question is... > &g...

Can the color of the Command Bar be changed?
When you open up a window to show the contents of a folder, just below the usual Menu Bar is the Command Bar with menus like "Organize" and "Views." That Command Bar has a sickly blue-green color. Is there any way to change the color of the Command Bar? At the very least, I would like that color to be less saturated. -- Steven L. ...

Suppressing Report Headers or How to Report/Display Parent/Child/Granchild relationships
Ok, So, what I have done is create a set of tables that hold data about terms and their definitions. Each term (except the root term) have a parent. There are 5 tables: Root, Grandparents, Parents, Children and Grandchildren. The children of grandparents are stored in the Parents table, etc. So, I've created queries to rejoin all of this a table where the root and its metadata are in column 1-3, grandparents in 4-6, parents in 7-9, children in 10-12 and grandchildren in 13-15. The problem is that not every parent has a child. So, in the query results there are empty cells/values, that'...

many table in one report
dearsir, how to establish relationship and normalise to get the report for the tables below viz.[fuelinvoces] field invoiceid 'text' (PK) " invoceddate 'date/time' " invoicedquantity 'number' " actual quantity ' number' " decanted storagetankname ' text' table [storagetankdata] field decantingid 'autonumber'(pk) ,,(i have not found any altarnative id ) " tankname " tankmeasurement beforedecant 'number' " tankmeasurementafterdecant 'number&...

Problems with CListCtrl
I'm having trouble with a CListCtrl object. I'm trying to automatically set the selected items of the list from my code. I try the following statement: m_List.SetItem (pos, 0, LVIF_STATE, NULL, 0, LVIS_SELECTED, LVIS_SELECTED, 0); The SetItem function returns non-zero, which supposedly means it was successful. However, I don't see any selection showing up. I even called RedrawItem on this list item, but it didn't help either. Anyone know about this? -Eric >I'm having trouble with a CListCtrl object. I'm trying to automatically >set the selected ite...

CTreeCtrl and CListCtrl problem
I use create a single document struct using MFC(explore style).The left of the window is CLeftView class(which inherit CTreeView).The right is CBrowserView which inherit CListView.I want to display the content of a directory in the right(CListview) when user click the item of the ctreectrl. In the LeftViw I add method "void CLeftView::OnClickItem (NMHDR* pNMHDR, LRESULT* pResult)" because I want to know which item be clicked by user. ////////////////Leftview////////////////////// CTreeCtrl& mtree=GetTreeCtrl(); HTREEITEM item=mtree.GetSelectedItem(); data=mtree.GetItemDat...

Report Writer #4
Is it possible in Great Plains 7.5 to do cross tab reports in Report Writer? ...

How to create a HTMP report ?
Hello. I'm working with VC++6 and would like my application able to create a small HTML report with titles and some text. Could you please give me some ideas ? with many thanks. Marc. Hmm, and what is your problem? Just open text file, and generate html by writing instructions directly. 1. You have to know at least basics of html 2. First create several reports manually to get design etc. Next use this samples for generation. Igor Green Compare It! + Synchronize It! - files and folders comparison never was easier! Marc Loiry wrote: > Hello. > &g...

Corrupted "deleted Item" folder in microsoft outlook 2000
Hi all, I have this spam mail in my deleted item folder which i am not able to delete it away. When i tried to delete it, open it, move it to other folder etc ... outlook 2000 will have an error and will close down and i have to restart it. I tried lots of methods suggested by some nice people in here but stil it doesnt work. Is there any way or how can i have a whole new "deleted item" folder without losing my other folders and emails as well ?? Pls help.... thanksss Yes, per personal experience. Make a new PST, even customize the name of it for yourself. Make it the def...

Crosstab Report 02-25-10
Thank you for taking the time to look into this problem. Using Access2007, How can I create a report that looks like this?: ‘ ColumnHead (AuditorID) ‘ Satisfactory Unsatisfactory RowHead1(FloorProgName) RowHead2(FloorProgCriteriaShortDetails) 0 1 RowHead2(FloorProgCriteriaShortDetails) 1 0 RowHead2(FloorProgCriteriaShortDetails) 2 0 RowHead2(FloorProgCriteriaShortDetails) ...

Report Format
Env: CRM 3, VS 2003, remote connect to CRM server. I've created a QUOTE in VS2003 and when viewed using PREVIEW from within the VS environment it produces a beautiful QUOTE (at least in my opinion). When printed, again from the VS environment, it is perfect. When I upload the RDL file to the CRM server, create an new REPORT using this RDL then produce a REPORT, the formatting is all over the place. When I inspect the source (in VS) there are no fields that extend past the defined size. It appers that the CRM report engine randomly adds CRLFs all thru the report ... ??? ...

VS Tools & Crystal Report
Hi, I have customise the PO Entry screen to show a crystal report (popup a new form with a crystal report viewer) when user click a button, there was no error when user first clicked the button however subsequently it will prompt a exception message "Load report failed" but when I use the debugging and step into the code, there was no error and the report show up correctly...any idea? ...

Exmerge Items from the Dumpster
I'm using Exmerge and choosing the option to extract 'Items from the dumpster.' However, when I open up the pst file that is created, I don't see any of the items from the dumpster. I have verified that I have Send As and Receive As rights over the database. I've also verified that there are actually items in the dumpster to extract. What else am I missing...? when you use exmerge to extract these items, they will appear in the folders they were in just prior to being sent to the dumpster... -- Susan Conkey [MVP] "Adoyt" <Adoyt@discussions.microso...

Great Plains Reports and Printing
We are printing our Great Plains Report to a High Speed Dot Matrix Line Printer. By default, the font and pitch are quite small, and if we try to increase the size on the control panel of the printer, it has no effect. My question is this, in order to get font sizes to come out larger on our Great Plains Reports, do we have to change each individual field in the Report Designer? Does the Report Designer settings override whatever settings the printer may have? Thanks The font size for Text reports (especially when the size is set to Best Text Fit) is decided by the size of the repor...

Price Lists
I think I know what the answer is going to be. Our retail arm sells all products at 100% of list price; the item price lists are set up accordingly. However we'd like to have a price level of cost+0%, which we can use to sell items to certain wholesale divisions of our company. It doesn't look like I can assign two price levels having different price methods to the same item. Am I right? Our list price includes GST and markup, so figuring cost backwards from list will always be a two step process (in case anyone was about to suggest that). Am I missing something? You can set...

Report needed
I needed a assistance to modify the inventory receipt report to show the Gross Profit for each item. This is required when the items are being received into the store. Can anyone assist? Regards, Don This is a multi-part message in MIME format. ------=_NextPart_000_00F3_01C92F90.CDA8D600 Content-Type: multipart/alternative; boundary="----=_NextPart_001_00F4_01C92F90.CDA8D600" ------=_NextPart_001_00F4_01C92F90.CDA8D600 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Don, Try this one attac...