Results 1 to 15 of 15

Thread: Treeview Division By Zero Error.Pleas fix this for me.

  1. #1

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    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.
    Attached Files Attached Files

  2. #2
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    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?

    IIF(Post.Rate > 0 , , )

  3. #3

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    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

  4. #4
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    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

    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.

    IIF(Post.Rate > 0 , , )

  5. #5

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    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.

  6. #6
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    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.

    http://www.mvps.org/emorcillo/en/cod...ropimage.shtml

    IIF(Post.Rate > 0 , , )

  7. #7
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    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 ?????
    IIF(Post.Rate > 0 , , )

  8. #8

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    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.

  9. #9
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269

    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

  10. #10

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    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)

  11. #11

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    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.

  12. #12
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    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.
    IIF(Post.Rate > 0 , , )

  13. #13
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    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.

    IIF(Post.Rate > 0 , , )

  14. #14

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    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.

  15. #15
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    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.

    IIF(Post.Rate > 0 , , )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width