How to safely disconnect from a webcam ....
-
hello i have written an application to take pictures from a webcam (using APIs) 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 too.(expect this problem the application is running smoothly) i am calling the "EndAppln" procedure in a closebutton_click and in the queryunload event of the main form please see the code below . . . . Any one please suggest any changes to be made to my application TO SAFELY CLOSE MY APPLICATION ?. '***** variables declared in a bas module Public Const CAP_START = &H400 Public Const CAP_GET_CAPSTREAMPTR = CAP_START + 1 Public Const CAP_SET_CALLBACK_ERROR = CAP_START + 2 Public Const CAP_SET_CALLBACK_STATUS = CAP_START + 3 Public Const CAP_SET_CALLBACK_YIELD = CAP_START + 4 Public Const CAP_SET_CALLBACK_FRAME = CAP_START + 5 Public Const CAP_SET_CALLBACK_VIDEOSTREAM = CAP_START + 6 Public Const CAP_SET_CALLBACK_WAVESTREAM = CAP_START + 7 Public Const CAP_DRIVER_CONNECT = CAP_START + 10 Public Const CAP_DRIVER_DISCONNECT = CAP_START + 11 '***** private sub EndAppln ' 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) ''''' end of the callback DoEvents capDriverDisconnect (mywdc) capCaptureStop (mywdc) DestroyWindow (mywdc) ' the API declared in the bas module UnLoad Me End End Sub Thanks in advance Mohan G Mohan G
-
hello i have written an application to take pictures from a webcam (using APIs) 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 too.(expect this problem the application is running smoothly) i am calling the "EndAppln" procedure in a closebutton_click and in the queryunload event of the main form please see the code below . . . . Any one please suggest any changes to be made to my application TO SAFELY CLOSE MY APPLICATION ?. '***** variables declared in a bas module Public Const CAP_START = &H400 Public Const CAP_GET_CAPSTREAMPTR = CAP_START + 1 Public Const CAP_SET_CALLBACK_ERROR = CAP_START + 2 Public Const CAP_SET_CALLBACK_STATUS = CAP_START + 3 Public Const CAP_SET_CALLBACK_YIELD = CAP_START + 4 Public Const CAP_SET_CALLBACK_FRAME = CAP_START + 5 Public Const CAP_SET_CALLBACK_VIDEOSTREAM = CAP_START + 6 Public Const CAP_SET_CALLBACK_WAVESTREAM = CAP_START + 7 Public Const CAP_DRIVER_CONNECT = CAP_START + 10 Public Const CAP_DRIVER_DISCONNECT = CAP_START + 11 '***** private sub EndAppln ' 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) ''''' end of the callback DoEvents capDriverDisconnect (mywdc) capCaptureStop (mywdc) DestroyWindow (mywdc) ' the API declared in the bas module UnLoad Me End End Sub Thanks in advance Mohan G Mohan G
The problem might not be in your application at all. It's possible that it's in the API for the webcam. Usually, something like this happens because not all resources and handles are freed before you quit. Check to make absolutely sure you free all the resources you allocate and close any handles you have and make sure your shutting down the API correctly so it can free up any resources that it has allocated. After doing that you'd have to get ahold of developer support for the API to find a solution. Hey! Maybe you've found a bug! :) RageInTheMachine9532
-
The problem might not be in your application at all. It's possible that it's in the API for the webcam. Usually, something like this happens because not all resources and handles are freed before you quit. Check to make absolutely sure you free all the resources you allocate and close any handles you have and make sure your shutting down the API correctly so it can free up any resources that it has allocated. After doing that you'd have to get ahold of developer support for the API to find a solution. Hey! Maybe you've found a bug! :) RageInTheMachine9532
-
thank you rage i am puzzled here, how to debug my application exactly. will you please help me to fix this problem.i will send the whole application . ok. Mohan G
It's just a thorough code review. If you can eliminate everything YOUR doing as a possible cause, then the cause is in the API your using. RageInTheMachine9532
-
It's just a thorough code review. If you can eliminate everything YOUR doing as a possible cause, then the cause is in the API your using. RageInTheMachine9532
thank you rage i have gone through my code. I am not good in working with API.This is a simple application (i mean less no. of lines of code).can you please check my code.(this is very urgent for me to fix this problem).so i look forward for an helping hand like you. Mohan G
-
thank you rage i have gone through my code. I am not good in working with API.This is a simple application (i mean less no. of lines of code).can you please check my code.(this is very urgent for me to fix this problem).so i look forward for an helping hand like you. Mohan G
Send it to my email address. I'm also going to need the address to pick up a copy of the SDK your using. RageInTheMachine9532