home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2001 July / VPR0107B.BIN / DRIVER / CANOPUS / MVR32 / mvr32.exe / data1.cab / Development_Kit / Vc / Samples / Encode / TimeDlg.cpp < prev    next >
C/C++ Source or Header  |  2001-02-09  |  7KB  |  166 lines

  1. //======================================================================
  2. // -- TimeDlg.cpp --                                                    
  3. //                                                                      
  4. //  MVR-D2000                                                           
  5. //                                  エンコード  サンプルプログラム      
  6. //                                  Encode      sample program          
  7. //                                                                      
  8. // Copyright (C) 1999-2000 Canopus Co., Ltd. All rights reserved.       
  9. //======================================================================
  10. //                                                                      
  11. // -- サンプルプログラムをご使用になる前に ---                          
  12. // -- Before use this sample program... --                              
  13. //                                                                      
  14. // このサンプルプログラムは、カノープス製品を使うためにご使用ください。 
  15. //  Please use this sample progeam to use products of canopus.          
  16. //                                                                      
  17. //======================================================================
  18. // TimeDlg.cpp : インプリメンテーション ファイル
  19. //
  20.  
  21. #include "stdafx.h"
  22. #include "Encode.h"
  23. #include "TimeDlg.h"
  24.  
  25. #ifdef _DEBUG
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30.  
  31. extern    int    ENC_ID;
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CTimeDlg ダイアログ
  35.  
  36.  
  37. CTimeDlg::CTimeDlg(CWnd* pParent /*=NULL*/)
  38.     : CDialog(CTimeDlg::IDD, pParent)
  39. {
  40.     //{{AFX_DATA_INIT(CTimeDlg)
  41.         // メモ - ClassWizard はこの位置にマッピング用のマクロを追加または削除します。
  42.     //}}AFX_DATA_INIT
  43. }
  44.  
  45.  
  46. void CTimeDlg::DoDataExchange(CDataExchange* pDX)
  47. {
  48.     CDialog::DoDataExchange(pDX);
  49.     //{{AFX_DATA_MAP(CTimeDlg)
  50.     DDX_Control(pDX, IDC_EDIT_TIME, m_Edit_Time);
  51.     DDX_Control(pDX, IDC_CHECK_LIMIT_TIME, m_Check_Time);
  52.     //}}AFX_DATA_MAP
  53. }
  54.  
  55.  
  56. BEGIN_MESSAGE_MAP(CTimeDlg, CDialog)
  57.     //{{AFX_MSG_MAP(CTimeDlg)
  58.     //}}AFX_MSG_MAP
  59. END_MESSAGE_MAP()
  60.  
  61. /////////////////////////////////////////////////////////////////////////////
  62. // CTimeDlg メッセージ ハンドラ
  63.  
  64. //----------------------------------------------------------------------
  65. // #[ CTimeDlg::OnInitDialog ]                                          
  66. //                                                                      
  67. // 機能     キャプチャ時間の設定                                        
  68. //                                                                      
  69. //  引数:      なし                                                    
  70. //                                                                      
  71. //  戻り値:    BOOL    TRUE                                            
  72. //                      FALSE                                           
  73. //                                                                      
  74. //----------------------------------------------------------------------
  75. // #[ CTimeDlg::OnInitDialog ]                                          
  76. //                                                                      
  77. //  Function:   Initialize recorde time dialog                          
  78. //                                                                      
  79. //      Parameters:     none                                            
  80. //                                                                      
  81. //      Return value:   BOOL    TRUE                                    
  82. //                              FALSE                                   
  83. //                                                                      
  84. //----------------------------------------------------------------------
  85. BOOL CTimeDlg::OnInitDialog() 
  86. {
  87.     ENC_RETURN  enc_return;
  88.     UINT        rec_time;
  89.     UINT        enable;
  90.     char        szText[16];
  91.     CString     strMessage;
  92.  
  93.     CDialog::OnInitDialog();
  94.  
  95.     // 現在の設定時間の取得
  96.     // Get record time
  97.     enc_return = ENC_Get_Record_Time(ENC_ID, &rec_time, &enable);
  98.     if(enc_return != ENC_SUCCESS)
  99.     {
  100.         strMessage.LoadString(IDC_ERROR_GET_PARAMETER);
  101.         MessageBox(strMessage);
  102.         return FALSE;
  103.     }
  104.  
  105.     // 時間制限のチェック
  106.     // Check Limit Time
  107.     m_Check_Time.SetCheck(enable);
  108.  
  109.     // キャプチャ時間の設定
  110.     // Set Record Time
  111.     wsprintf(szText, "%ld", rec_time);
  112.     m_Edit_Time.SetWindowText(szText);
  113.  
  114.     return TRUE;  // コントロールにフォーカスを設定しないとき、戻り値は TRUE となります
  115.                   // 例外: OCX プロパティ ページの戻り値は FALSE となります
  116. }
  117.  
  118. //----------------------------------------------------------------------
  119. // #[ CTimeDlg::OnOK ]                                                  
  120. //                                                                      
  121. // 機能     キャプチャ時間の設定を有効にする                            
  122. //                                                                      
  123. //  引数:      なし                                                    
  124. //                                                                      
  125. //  戻り値:    なし                                                    
  126. //                                                                      
  127. //----------------------------------------------------------------------
  128. // #[ CTimeDlg::OnOK ]                                                  
  129. //                                                                      
  130. //  Function:   Set record time                                         
  131. //                                                                      
  132. //      Parameters:     none                                            
  133. //                                                                      
  134. //      Return value:   none                                            
  135. //                                                                      
  136. //----------------------------------------------------------------------
  137. void CTimeDlg::OnOK() 
  138. {
  139.     ENC_RETURN  enc_return;
  140.     UINT        rec_time;
  141.     UINT        enable;
  142.     char        szText[32];
  143.     CString     strMessage;
  144.  
  145.     // 時間制限のチェック
  146.     // check limit time
  147.     enable = (m_Check_Time.GetCheck() ?  TRUE : FALSE);
  148.  
  149.     // キャプチャ時間の設定
  150.     // set record time
  151.     m_Edit_Time.GetWindowText(szText,sizeof(szText));
  152.     rec_time = atol(szText);
  153.  
  154.     // パラメータの設定
  155.     // Set recorde parameter
  156.     enc_return = ENC_Set_Record_Time(ENC_ID, rec_time, enable);
  157.     if(enc_return != ENC_SUCCESS)
  158.     {
  159.         strMessage.LoadString(IDC_ERROR_SET_PARAMETER);
  160.         MessageBox(strMessage);
  161.         return;
  162.     }
  163.  
  164.     CDialog::OnOK();
  165. }
  166.