>I am attempting to drag highlighted listitems from a ListView object and in to a tree node in a TreeView.
>
>For my purpose, all I need to know is the node that the items have been dropped on. According to the documentation, I need to call the HitTest() method in the TreeView object and assign the return value to the TreeView.DropHighLight property. However, everytime that I call the HitTest() method, I get an empty string.
>
>What am I doing wrong?
>
>Thank you
First you need to disable ActiveX Control Dual Interface with
=SYS(2333,0) in Form.Load()
then you need to scale mouse coordinates converting them to twips
loNode=this.HitTest(X * nFactorX, Y * nFactorY)
and as far as I remember for calculating those factors I was using this code:
* Calculate the conversion factor between VFP window units (in pixels) and
* TreeView window units (in twips).
LOCAL liHWnd, ;
liHDC, ;
liPixelsPerInchX, ;
liPixelsPerInchY
* Define some constants.
#DEFINE cnLOG_PIXELS_X 88
* From WINGDI.H
#DEFINE cnLOG_PIXELS_Y 90
* From WINGDI.H
#DEFINE cnTWIPS_PER_INCH 1440
* 1440 twips per inch
* Declare some Windows API functions.
DECLARE integer GetActiveWindow in WIN32API
DECLARE integer GetDC in WIN32API ;
integer iHDC
DECLARE integer GetDeviceCaps in WIN32API ;
integer iHDC, integer iIndex
* Get a device context for VFP.
liHWnd = GetActiveWindow()
liHDC = GetDC(liHWnd)
* Get the pixels per inch.
liPixelsPerInchX = GetDeviceCaps(liHDC, cnLOG_PIXELS_X)
liPixelsPerInchY = GetDeviceCaps(liHDC, cnLOG_PIXELS_Y)
* Get the twips per pixel.
nFactorX = cnTWIPS_PER_INCH / liPixelsPerInchX
nFactorY = cnTWIPS_PER_INCH / liPixelsPerInchY
*************************************************************
Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison