View Full Version : Problem initializing device dialog

December 2, 2003, 13:01:48
i started my project with a doc-view architecture as explained in the "first steps" and continued with it and now i added the device dialog class but when i run the program i get the message "the dialog couldn't be initialized " and when i tried to debug the program i found that the code in main frame:

if ( pVidCapDevList != 0 )
DShowLib::Grabber::tVidCapDevListPtr::value_type:: iterator itdev =
std::find( pVidCapDevList->begin(), pVidCapDevList->end(), std::string(text) );

if ( !( itdev == pVidCapDevList->end() ) )
m_CurrentVideoCaptureDevice = text;
return nothing so the grabber don't find any device to open although the similar code i implemented previously in CView::OnInitialUpdate();
is working and i just copied the code for the main frame from graphicoverlay demo code .

please help

Stefan Geissler
December 2, 2003, 15:37:58

If you have only added the device selection dialog by referencing the .h and the .cpp file, the resource is not copied. Copying resources from one project to another is with VC 6.0 a litte bit strange. You must start your Visual C++, open the Demoapp project and copy the dialog in the tree view of the resource view. Then you close the project (not Visual C++ IDE) and open your new project. You change to the resources view and paste now the dialog. Then the dialog resource is shown.
The dialog should be shown anyway, even if there are not devices connected to you computer and the device list is empty.
I also suggest to copy the DeviceDLG.* files to your new project and change the includes. Also the registry using should be removed. You will get an error about undefined values.

December 2, 2003, 17:56:11
i made a new dialog box with the same look like the demo program and named the combo boxes the same so i don't need to change any thing in the device.cpp or the header file and added all the functunality from the classwizard and then copied the code into it ..
and i don't get any error in compilation just when i run the program and click on the button of the dialog i get the same message as in the domodal case -1

and also i added all the regestry variables and added the addithonal code to main frame
i think that m_grabber don't find the device to open it then the dialog has some error but i get the same message as in case -1 and this is not clear why

Stefan Geissler
December 3, 2003, 13:56:58

Please comment all things, that are not necessary to show the dialog, like getting the video capture devices etc. Then start your application and check, whehter the dialog will be displayed. If not, you have created a program error. As i wrote in my last post, it is not easy to copy a complete dialog class with resources from one project to another.
The compiler will not detect an error but at runtime an initialization error occurs, if something is wrong in the resource file. Also the resource.h must contain all IDs that are used in the dialog.