// Sample0Dlg.h : header file // #if !defined(AFX_SAMPLE0DLG_H__A385E399_D0CA_4202_9755_E5DC10D5DD4E__INCLUDED_) #define AFX_SAMPLE0DLG_H__A385E399_D0CA_4202_9755_E5DC10D5DD4E__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 ///////////////////////////////////////////////////////////////////////////// // CSample0Dlg dialog class CSample0Dlg : public CDialog { // Construction public: CSample0Dlg(CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(CSample0Dlg) enum { IDD = IDD_SAMPLE0_DIALOG }; //CEdit m_OutA, m_OutB; CString m_Instructions; CStatic m_Status; CStatic m_BitControl[ 16 ]; CStatic m_ButtonControl[ 1 ]; CEdit m_Out[ 1 ]; // NOTE: the ClassWizard will add data members here //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CSample0Dlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); //}}AFX_VIRTUAL // Implementation protected: HICON m_hIcon; // Generated message map functions //{{AFX_MSG(CSample0Dlg) virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); afx_msg void OnExit(); virtual void OnCancel(); afx_msg void OnWriteA(); afx_msg void OnWriteB(); afx_msg void OnBit0a(); afx_msg void OnBit1a(); afx_msg void OnBit2a(); afx_msg void OnBit3a(); //}}AFX_MSG DECLARE_MESSAGE_MAP() private: // bitmaps for bit controls CBitmap Bmp0; // displayed if bit is 0 CBitmap Bmp1; // displayed if bit is 1 CBitmap BmpND; // displayed if device is not detected unsigned long m_DeviceIndex; // unsigned char m_Data[ 2 ]; unsigned char m_OutMask; bool m_DeviceDetected; private: // Process user's click of a 'bit' control // - bit: bit number (0..7) void BitClicked( int bit ); // update controls to the current state (Input/Output and Bit) void UpdateDisplay(); // send DIO_WriteAll command to the card with FFFF // and intialize data structures void InitializeDevice( void ); // check if the card is connected and if yes // set m_DeviceDetected variable accordingly // returns: true if USB-IIRO-16 card is connected, // false otherwise bool DetectDevice( void ); // read all ports and update all 'read' ports // if the driver reports an error, set m_DeviceDetected to false void ReadAll(); // callback function for timer // - if device is connected - calls 'ReadAll()' // if not - calls DetectDevice()' void OnTimer( UINT nIDEvent ); }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_SAMPLE0DLG_H__A385E399_D0CA_4202_9755_E5DC10D5DD4E__INCLUDED_)