Using axvlc.dll version 3.0.3.0 in VB6
Posted: 22 Jan 2019 12:18
This may be of some help to users of the axvlc.dll. It relates to using that control in VB6.
We have a stud farm and we use cheap video cams on our LAN to monitor our horses especially near foaling time. As I am familiar with VB6 I wrote a Windows program that can be used to view and pan/tilt our cams. But when expanding our stabling we needed new (cheap) cams, and all the new ones in our price range were ONVIF cameras using H264 video.
To display video from those cameras I found the axvlc.dll which does a reasonable job of handling the display from them (and most of my older ones).
But there was one major problem with the dll - my existing program doesn't use any pan/tilt on-screen controls. Pan/tilt is activated by clicking on the video display (the display surface is divided into 9 squares conceptually and e.g. clicking in the upper right square will cause the camera to tilt up and pan right). I discovered that the dll's display surface is running in a different thread to the main program and it's not accessible via the properties exposed by the control so no possibility of 'click' events.
I'd have to use 'subclassing' to get the display window's message queue. The first job was to search for that window in the process's window tree to get its window handle. As the window was in a different thread to the main process's thread, using a WH_MOUSE hook to subclass the video output window's messages was a recipe for crashing the process both in the VB IDE and as an exe.
However the low level mouse hook (SetWindowsHookEx(WH_MOUSE_LL, ...)) (I believe) returns mouse messages in the context of the process's main thread. In that hook I can filter out mouse left button down messages and, using the WindowFromPoint API, determine if the mouse was clicked in the in the video output window. If that was the case I post a message back to the main window of the process to do the pan/tilt.
I can provide detailed code information if anyone is interested!
We have a stud farm and we use cheap video cams on our LAN to monitor our horses especially near foaling time. As I am familiar with VB6 I wrote a Windows program that can be used to view and pan/tilt our cams. But when expanding our stabling we needed new (cheap) cams, and all the new ones in our price range were ONVIF cameras using H264 video.
To display video from those cameras I found the axvlc.dll which does a reasonable job of handling the display from them (and most of my older ones).
But there was one major problem with the dll - my existing program doesn't use any pan/tilt on-screen controls. Pan/tilt is activated by clicking on the video display (the display surface is divided into 9 squares conceptually and e.g. clicking in the upper right square will cause the camera to tilt up and pan right). I discovered that the dll's display surface is running in a different thread to the main program and it's not accessible via the properties exposed by the control so no possibility of 'click' events.
I'd have to use 'subclassing' to get the display window's message queue. The first job was to search for that window in the process's window tree to get its window handle. As the window was in a different thread to the main process's thread, using a WH_MOUSE hook to subclass the video output window's messages was a recipe for crashing the process both in the VB IDE and as an exe.
However the low level mouse hook (SetWindowsHookEx(WH_MOUSE_LL, ...)) (I believe) returns mouse messages in the context of the process's main thread. In that hook I can filter out mouse left button down messages and, using the WindowFromPoint API, determine if the mouse was clicked in the in the video output window. If that was the case I post a message back to the main window of the process to do the pan/tilt.
I can provide detailed code information if anyone is interested!