Click here to Skip to main content
15,903,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have created a class to use several webcams to fit my own needs using the avicap32.dll. Webcam features such as eyetracking and recording function properly. I'm however facing a small setback that mouseclicks are no longer detected when clicking the user control. I blame this on the following line of code. pn is a panel in the usercontrol.

<br />
hWnd = Webcam.capCreateCaptureWindowA("0", Webcam.WS_VISIBLE | Webcam.WS_CHILD, 0, 0, 0, 0, pn.Handle, 0);<br />


This line sort of overlaps the panels I use to draw the webcam images on, so I can't actually click them.
Is there a way to detect these event by using WindowProc of the parent form or hooking into the created window? Or is there a cleaner way to solve this? I already looked into SetWindowLongPtr, but this seems kind of dirty business to me because of subclassing and I wouldn't want to mess with those things since I am running out of time...
I specifically want to let the user define a set of points on the webcam image. Just the coordinates.

Thanks in advance
Posted
Updated 12-Dec-10 4:03am
v2

I would go on with hooking. There is an article here that may help you to intercept mouse messages in the parent window (I haven't tried it), but even if its working I think that the hooking is the cleaner (and 100% working) solution, and maybe the only one. Unfortunately there are a lot of scenarios in GUI programming when the only solution is hooking. It isn't that dirty solution as it seems to be for the first time, just hide the above window creation call and the hooking to a class and don't think of it again! :laugh:
 
Share this answer
 
Comments
Steven Solberg 12-Dec-10 13:36pm    
And by hiding the call you mean putting a region around it with caption: "Warning, contains shocking statements"? :-D I just solved the issue myself actually. And it did indeed involve hooking. Thanks for your effort though. It is very much appreciated. :)
Found my own answer involving hooking the created window.
This is the link I found. May it serve future readers as it served me ;)

http://www.eggheadcafe.com/software/aspnet/33974118/-subclassing-an-unmanaged-wndproc.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900