CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: SetCapture API

  1. #1
    Join Date
    Apr 1999
    Location
    Netherlands
    Posts
    181

    SetCapture API

    Hi
    I'm trying to use the SetCapture API on a listview, placed on a form, which will be shown instead of a dropdown box.
    If I've called the SetCapture, with the hwnd of the listview, that works fine, I get the msg I want (so I can let it dissapear when the user clicks outside the window, just like the dropdown box). But, for some reason, if I click on the listview, I have to click twice. First to get rid of the capture, and 2nd to select an item.
    I've used the SetCapture before when I created a flatbutton, and that works fine (and I don't have to click twice for a click event).
    Has anyone an idea why it works that way with the listview? Since this is pretty annoying, I use a workaround (in the mousemove, if the mouse is (Left + 150, etc) I set the capture, but since you can cheat windooz by moving the mouse fast, this isn't cool.
    I'm out of ideas.. anyone?

    Thanx :-)

    Crazy D :-)

  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: SetCapture API

    Hi

    I've also had fun&games with SetCapture - sometimes VB seems to release the capture internally which can prove to be a real headache.

    One of the best solutions to this that I've seen is over at vbAccelerator.

    http://vbaccelerator.com/codelib/ddtoolwn/ddtoolwn.htm

    This code shows how to make a drop-down window / control out of *ANY* existing control on your form (you need to use the SSUBTMR dll from the site - or use your own subclassing methods).

    I've been using it for a while (not on a listview) and haven't had any trouble with it.


    Regards

    Chris Eastwood

    CodeGuru - the website for developers
    http://www.codeguru.com/vb

  3. #3
    Join Date
    Apr 1999
    Location
    Rotterdam, Netherlands
    Posts
    278

    Re: SetCapture API

    Tnx Chris I go check it out


  4. #4
    Join Date
    Apr 1999
    Location
    Netherlands
    Posts
    181

    Re: SetCapture API

    It works pretty neat with the picturebox, but I still have the same problem.. click once to get rid of the capture... only this time I can't select an item at all :-(
    Maybe I'm too sleepy but I get the idea that the listview isn't made for this...

    (some headaches later...)
    Ok fixed it...... just use good old subclassing and forget the setcapture...

    Crazy D :-)

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

Featured