PDA

View Full Version : error Message when close window



webmice
March 5, 2004, 21:26:52
I try the FirstStep

The Live video displayed

After I close the window , The error message come out ,

Debug Assertion Failed !
Program ... IC IMAGING CONTROL 1.4\first\debug\first.exe
File wincore.cpp
Line 2655

What's wrong ????

Stefan Geissler
March 8, 2004, 08:39:28
Hello,

You should check,whether the grabber is still showing a live video, when you window is destroyed. First of all, stop the live video, then destroy the window.

webmice
March 9, 2004, 17:05:30
void CFirstStepView::OnDestroy()
{
m_pGrabber->stopLive();
// this call will also succeed if no device is open
m_pGrabber->closeDev();

CView::OnDestroy();
// TODO: Add your message handler code here

}

What's Wrong ????

Stefan Geissler
March 10, 2004, 08:11:18
Please zip your project and send it to support at imagingcontrol dot com, so i can have a look on it.

webmice
March 10, 2004, 21:39:35
After add some code as follow , without any error message

void CFirstStepView::OnDestroy()
{
m_pGrabber->stopLive();
m_pGrabber->closeDev();

if( m_pGrabber->isLive() )
{
AfxMessageBox("Capture Device Still Live!!");
}
else
{
AfxMessageBox("Capture Device Stop!!");


}
CView::OnDestroy();
}

but when I delete

if( m_pGrabber->isLive() )
{
AfxMessageBox("Capture Device Still Live!!");
}
else
{
AfxMessageBox("Capture Device Stop!!");


}

the error message comes again !!!

:confused: :confused: :confused: :confused: :confused: :confused: :confused:

Stefan Geissler
March 11, 2004, 15:06:33
Hello,

I found the problem. The Grabber should not be a member of CView. It should rather be a member of CDocument. Especially a call to startLive from a method of CView and the destruction of the Grabber in the CView destructor cause problems.
This is not documented in the Classlibary's Users Guide. This seems to be a new issue of IC Imaging Control 1.4 / 1.41.

The "First Steps" section of the Class Librarie's Users Guide instructs you to setup the grabber (selecting a device and video format) in CFirstStepView::OnInitialUpdate() .
Instead of doing so, you should rather setup the grabber in CFirstStepDoc::OnNewDocument().
To get the handle on the CFirstStepView window, use following code:


POSITION pos = GetFirstViewPosition();
CView* pFirstView = GetNextView( pos );
m_pGrabber->setHWND( pFirstView->GetSafeHwnd() );


This problem is fixed, if m_pGrabber->startLive() is called after the CDocument is initialized. Therefore insert a new public method called “startLive()” into your CDocument class.



void CFirstStepDoc::startLive()
{
if( m_pGrabber->isDevValid()) m_pGrabber->startLive();
}

This new method must be public, because it is called from your CMainFrame object.
Now open the mainframe.cpp and insert the following include line under the last #include statement:


#include "FirstStepDoc.h"


Now add the “startLive()” public method to your CMainFrame class:


void CMainFrame::startLive()
{
CFirstStepDoc* pDocument = (CFirstStepDoc*)GetActiveDocument();
pDocument->startLive();
}

This method retrieves the first active document (it is only one available), cast it to out CFirstStepDoc class and calls it's startLive() method.

At least CMainFrame::startLive() must be called after the CView and CDocument has been created. This is done in the CFirstStepApp::InitInstance() after m_pMainWnd->UpdateWindow().
Insert following line after m_pMainWnd->UpdateWindow():


((CMainFrame*)m_pMainWnd)->startLive();

webmice
March 11, 2004, 17:44:44
Whic Step I Start ??

can you zip this project to me ???:confused: :confused: :confused: :confused: :confused:

Stefan Geissler
March 12, 2004, 11:28:18
Just use the FirstSteps. I have attached the changed project.

webmice
March 12, 2004, 18:55:19
But Why I Choose New in mean Bar , Only the message come out ??:confused:

webmice
March 14, 2004, 12:01:03
I bulid your project , sometime will show error , after restart window can build "OK" Why ???

:confused: :confused: :confused:
public:
CFirstStepDoc* GetDocument();

c:\program files\the imaging source europe gmbh\ic imaging control 1.41\firststep\firststepview.h(20) : error C2143: syntax error : missing ';' before '*'

:confused: :confused: :confused:

Stefan Geissler
March 15, 2004, 11:33:21
Hello,

Please create a new directory in the samples\vc6 directory of the IC Imaging Control installation. Name this directory "MyFirstStep". Unzip the files of the FirstStepSDIsample into this directory. Doubleclick the "FirstStepSDISample.dsw" file. Open the file "FirstStepSDISample.cpp" and comment the line "#error "insert license key here!"" to avoid an errormessage. Now compile. This should work.

CFirstStepDoc is from the original FirstStep project. It is not used in the FirstStepSDISample project.