Treeview Division By Zero Error.Pleas fix this for me.
Hi all,
I have the foolowing project that is supposed to create a watermarked drag image of the text and icon of a certain node in the treeview when it is about to be dragged and dropped. I get a division by zero error. Please fix this for me. I am sure it's something minor.
Re: Treeview Division By Zero Error.Pleas fix this for me.
Checked your code but no error on dragging. Where does the error occur? How do we recreate it. I tried dragging also , but no error.
Your dragging is working for right mouse button. Its a bit annoying. Is it doen on purpose?
Re: Treeview Division By Zero Error.Pleas fix this for me.
That's very weird. The moment I try to drag the node, whether it's the right button or the left, I get 'Runtime Error 11 - Division By Zero' on this line of code:
Code:
Public Function TreeView_CreateDragImage(hwnd As Long, hitem As Long) As Long
TreeView_CreateDragImage = SendMessage(hwnd, TVM_CREATEDRAGIMAGE, 0, ByVal hitem)
End Function
Does the dragging and dropping work for you though? How is that possible?
I got this code of the internet. It is supposed to drag on the left button.
Last edited by Nitesh; Nov 19th, 2007 at 07:32 AM.
Reason: additional information
Re: Treeview Division By Zero Error.Pleas fix this for me.
Hi,
I downloaded the code again. Stlll the same. The value for hWnd is 68318 and the value for hitem is 1589984. The thing is when I used the treeview which is Microsoft Common Controls 5.0(SP2) it works. But in my project I am using the Treeview with Microsoft Common Controls 6.0(SP6). I can't change because there are certain things that would stop working in my treeview.
Re: Treeview Division By Zero Error.Pleas fix this for me.
well thats the same service pack I m using. VB SP5 and Common Control6.0 SP6. So I dont think its the Service Pack.
The thing is , there is no division visible there.
What is the purpose of this code? Create a Drag image? If so check this too.
I honestly don't know enough about this to give a lot of help. I do know
one thing, however. The api functions in comctl32 are more tied to
the comctl32.ocx (the Microsoft Windows Common Controls 5.0 in
components). There are some warnings in MSDN about using some of
the SendMessage stuff that works with that version of the Treeview to
the Treeview in mscomctl.ocx (Microsoft Windows Common Controls 6.0).
If nothing else, you might want to try switching out the 5.0 Treeview for
the 6.0 Treeview and see if it makes any difference.
Re: Treeview Division By Zero Error.Pleas fix this for me.
Public Function TreeView_CreateDragImage(hwnd As Long, hitem As Long) As Long
On Error Resume Next
TreeView_CreateDragImage = SendMessage(hwnd, TVM_CREATEDRAGIMAGE, 0, ByVal hitem)
End Function
This Fix is supposed to remove this error. But word of Caution, Before you do this, you may create a backup of your system. A restore point also.
Once I installed VB SP6 and my old apps went wild, so I had to Install VB6 and SP5 again. But this is just my expeirience.
Re: Treeview Division By Zero Error.Pleas fix this for me.
Thanks again zeezee,
your research has helped me alot. I am not sure whether to go ahead with this fix as i am at a critical stage in my project and I have a deadline for the end of this month. I have VB6 and SP6 already installed. Will I have a problem if I install this fix. You deserve an excellent rating for all your help.
Re: Treeview Division By Zero Error.Pleas fix this for me.
Well I m not sure whether there will be a problem or not. Your app works fine in my Versions. And I have VB6 SP5, not SP6. SP6 seems to have a bad reputation so I m going to stay with SP5.
If thsi is only for Aesthetic purpose, I suggest just finish the app working and then go for this change.