|
-
Jun 10th, 2015, 03:15 PM
#11
Re: CommonControls (Replacement of the MS common controls)
 Originally Posted by vb6rocks
Additionally, I was able to identify that the following line (in red) in VBCCR11 is what is causing the run-time error (Overflow):
Private Sub UserControl_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
If ListViewDragIndex > 0 Then
If ListViewHandle <> 0 Then
Dim P(0 To 1) As POINTAPI, RC As RECT
GetCursorPos P(0)
ScreenToClient ListViewHandle, P(0)
SendMessage ListViewHandle, LVM_GETITEMPOSITION, ListViewDragIndex - 1, ByVal VarPtr(P(1))
SendMessage ListViewHandle, LVM_GETVIEWRECT, 0, ByVal VarPtr(RC)
ListViewDragOffsetY = (P(1).Y - P(0).Y) + RC.Top
ListViewDragOffsetX = (P(1).X - P(0).X) + RC.Left
End If
If PropOLEDragMode = vbOLEDragAutomatic Then
Dim Text As String
Text = Me.FListItemText(ListViewDragIndex, 0)
Data.SetData StrToVar(Text & vbNullChar), CF_UNICODETEXT
Data.SetData StrToVar(Text), vbCFText
AllowedEffects = vbDropEffectMove Or vbDropEffectCopy
End If
End If
RaiseEvent OLEStartDrag(Data, AllowedEffects)
If AllowedEffects = vbDropEffectNone Then ListViewDragIndex = 0
End Sub
Is the same happening when you use the Std-Exe ListView?
If yes, what are the debug values? Maybe the var type 'Long' for ListViewDragOffsetX/Y is not sufficient..
EDIT: Ok you figured out that the RC.Top / RC.Left values (in fact LVM_GETVIEWRECT) are set to its max value and of course causing an Overflow exception. Try to declare ListViewDragOffsetX/Y as Double instead of Long. Does this solves the issue?
Last edited by Krool; Jun 10th, 2015 at 03:23 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|