/* * $RCSfile: sample0.cpp,v $ * $Date: 2009/10/09 17:24:35 $ * $Revision: 1.6 $ * jEdit:collapseFolds=1:tabSize=4: * * class CSample0App implementation */ #include "stdafx.h" #include "sample0.h" #include "DetectDialog.h" #include "sample0Dlg.h" #include "AIOUSB.h" BEGIN_MESSAGE_MAP( CSample0App, CWinApp ) //{{AFX_MSG_MAP(CSample0App) //}}AFX_MSG ON_COMMAND( ID_HELP, CWinApp::OnHelp ) END_MESSAGE_MAP() CSample0App theApp; CSample0App::CSample0App() { // nothing to do } // CSample0App::CSample0App() BOOL CSample0App::InitInstance() { #ifdef _AFXDLL Enable3dControls(); #else Enable3dControlsStatic(); #endif /* * if there is a single USB-AO16-16 family device on the bus, then use it; * otherwise, prompt the user for which device to use */ unsigned long productID; unsigned long deviceIndex = diOnly; bool deviceIndexValid = false; const unsigned long result = QueryDeviceInfo( deviceIndex, &productID, NULL, NULL, NULL, NULL ); if( result == ERROR_SUCCESS && productID >= 0x8140 && productID <= 0x815D ) { // deviceIndex = diOnly; deviceIndexValid = true; } else { DetectDialog detectDialog; detectDialog.DoModal(); if( detectDialog.GetDeviceIndex() >= 0 ) { deviceIndex = detectDialog.GetDeviceIndex(); deviceIndexValid = true; } // if( detectDialog.GetDeviceIndex() ... } // if( result ... if( deviceIndexValid ) { CSample0Dlg sampleDialog( deviceIndex, ( unsigned ) productID ); m_pMainWnd = &sampleDialog; sampleDialog.DoModal(); } // if( deviceIndexValid ) return deviceIndexValid ? TRUE : FALSE; } // CSample0App::InitInstance() /* end of file */