Click to See Complete Forum and Search --> : SetCapture API


Crazy D @ Work
May 19th, 1999, 10:32 AM
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 :-)

Chris Eastwood
May 19th, 1999, 10:47 AM
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

Crazy D
May 19th, 1999, 01:15 PM
Tnx Chris I go check it out

Crazy D @ Work
May 20th, 1999, 03:07 AM
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 :-)