How to close video capture .....
-
hello i have written this application to capture video and to save the picture into database.its working fine ... but when i try to close my application its NOT CLOSING PERFECTLY . some times it hangs. here is my code .... (note : here i might have missed some code and variable ... but the application is running ...) ' in the main form module Private Sub Form_Load() Dim lpszName As String * 100 Dim lpszVer As String * 100 Dim Caps As CAPDRIVERCAPS ' CAPDRIVERCAPS declared in a module ' Capture Window creation ' driver info capGetDriverDescriptionA 0, lpszName, 100, lpszVer, 100 mywdc = capCreateCaptureWindowA(lpszName, WS_CAPTION Or WS_THICKFRAME Or WS_VISIBLE Or WS_CHILD, 0, 0, 160, 120, Me.hwnd, 0) ' Setting the title of window SetWindowText mywdc, lpszName ' Setting the video callback function capSetCallbackOnStatus mywdc, AddressOf MyStatusCallback capSetCallbackOnError mywdc, AddressOf MyErrorCallback ' Connect to the driver If capDriverConnect(mywdc, 0) Then ' getting the capture driver capabilities capDriverGetCaps mywdc, VarPtr(Caps), Len(Caps) ' Start previewing the image capPreview mywdc, True ' resizing the widow to the whole image ResizeCaptureWindow mywdc End If End Sub private sub EndAppln ' code to end the application - called in form's queryunlocad and when close menu is selected in main form 'the below given are functions declared a module and called from the main form capSetCallbackOnError = SendMessage(lwnd,CAP_SET_CALLBACK_ERROR,0,lpProc) capSetCallbackOnStatus = SendMessage( lwnd,CAP_SET_CALLBACK_STATUS,0,lpProc) capSetCallbackOnYield = SendMessage(lwnd,CAP_SET_CALLBACK_YIELD, 0,lpProc) capSetCallbackOnFrame = SendMessage(lwnd,CAP_SET_CALLBACK_FRAME,0,lpProc) capSetCallbackOnVideoStream = SendMessage(lwnd,CAP_SET_CALLBACK_VIDEOSTREAM, 0,lpProc) capSetCallbackOnWaveStream = SendMessage(lwnd,CAP_SET_CALLBACK_WAVESTREAM, 0,lpProc) capSetCallbackOnCapControl = SendMessage(lwnd,CAP_SET_CALLBACK_CAPCONTROL, 0,lpProc) capCaptureStop (mywdc) capDriverDisconnect (mywdc) DestroyWindow (mywdc) ' here the API declared in the module, called UnLoad Me End End Sub any one please suggest any changes to be made to my application TO SAFELY CLOSE MY APPLICATION AN