1 Attachment(s)
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.:wave:
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. :confused:
Your dragging is working for right mouse button. Its a bit annoying. Is it doen on purpose?
:wave:
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?:confused:
I got this code of the internet. It is supposed to drag on the left button.
Re: Treeview Division By Zero Error.Pleas fix this for me.
I m not exactly sure why it is like this . I see no division at all there :confused:
But to be certain, download the code you uploaded here into somwhere else and try. Check the values of Hwnd and hitem when error occurs.
:wave:
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. :confused:
What is the purpose of this code? Create a Drag image? If so check this too.
http://www.mvps.org/emorcillo/en/cod...ropimage.shtml
:(
Re: Treeview Division By Zero Error.Pleas fix this for me.
ok here is something interesting.
http://www.xtremevbtalk.com/archive/.../t-103579.html
Quote:
Originally Posted by Thinker
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.
Any Explanation ?????
Re: Treeview Division By Zero Error.Pleas fix this for me.
Thanks so much zeezee. I will try that code out tomorrow. Hope it works.:wave:
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
basically willl ignore the error
Re: Treeview Division By Zero Error.Pleas fix this for me.
Hi again zeezee,
Thanks so much for all the information. I am getting the following error, please help me.
I get Invalid use of Addessof operator on this line:
Code:
m_lTimer = SetTimer(0, 0, 1, AddressOf pvTimerDragMove)
Re: Treeview Division By Zero Error.Pleas fix this for me.
Hi zeezee,
Your help is urgently needed. If I remove the line that causes the above error O still get the division by zero error on this line:
Code:
m_lIL = SendMessage(hWndTreeView, TVM_CREATEDRAGIMAGE, 0, ByVal hItem)
What do you suggest I do.
Re: Treeview Division By Zero Error.Pleas fix this for me.
Nitesh, I think you have to use the Older Treeview copntrol for this. Take a look at this thread.
http://www.codecomments.com/archive3...10-646393.html
At the las post, the OP mentions that Demo he got is Older Version than what he uses in his app. Same situation. I think you have no choice. :(
Re: Treeview Division By Zero Error.Pleas fix this for me.
ok here is a good news.
Check These
http://www.codenewsgroups.net/group/...topic1824.aspx
http://support.microsoft.com/?kbid=896559
http://www.microsoft.com/downloads/d...displaylang=en
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.
:wave:
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.
Thanks so much.
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.
:wave: