亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? alarm1dlg.cpp

?? 關于臺灣研華遠程以太網模塊上位機控制源代碼
?? CPP
字號:
// Alarm1Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "Alarm1.h"
#include "Alarm1Dlg.h"

#include <winsock2.h>
#include "..\..\..\include\adamtcp.h"

UINT ThreadProc( LPVOID lpParam );

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

char			szIPAddress[20];
static int		iTotalReceive;
static int		iTotalTimeout;
static int		iThreadIndex;
//----------------------------------------------
struct _StreamData   *pStreamData,StreamData;
struct _AlarmInfo    *pAlarmInfo,AlarmInfo;
static BYTE byLoopFlag=1;
HANDLE    hEvent;
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAlarm1Dlg dialog

CAlarm1Dlg::CAlarm1Dlg(CWnd* pParent /*=NULL*/)
	: CDialog(CAlarm1Dlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CAlarm1Dlg)
	m_strIPAddress = _T("");
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CAlarm1Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAlarm1Dlg)
	DDX_Text(pDX, IDC_EDIT_IPADDRESS, m_strIPAddress);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAlarm1Dlg, CDialog)
	//{{AFX_MSG_MAP(CAlarm1Dlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(ID_EXIT, OnExit)
	ON_BN_CLICKED(ID_START, OnStart)
	ON_BN_CLICKED(ID_STOP, OnStop)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAlarm1Dlg message handlers

BOOL CAlarm1Dlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	m_strIPAddress="172.18.1.41";
	SetDlgItemText(IDC_EDIT_IPADDRESS,m_strIPAddress);

	// get the DLL version 
	char   szCh[20];
    int    iVersion;    
 
	iVersion=ADAMTCP_GetDLLVersion();
	_ltoa( iVersion, szCh, 16 );
	SetDlgItemText(IDC_EDIT_DLLVER, szCh);

    //--- To initialize DLL to work ---
    int   iRetVal;

    iRetVal=ADAMTCP_Open();
    if( iRetVal!=0 )
    {
        MessageBox("ADAMTCP_Open() Failure !!!");
    }

    (CButton *)GetDlgItem(ID_STOP)->EnableWindow( FALSE );
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CAlarm1Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CAlarm1Dlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CAlarm1Dlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CAlarm1Dlg::OnExit() 
{
	// TODO: Add your control notification handler code here
    //--- Finally, calling ADAMTCP_Close() to release all allocated resource  ---
    ADAMTCP_Close();

	// TODO: Add your control notification handler code here
	CDialog::OnOK();		
}

void CAlarm1Dlg::OnStart() 
{
	// TODO: Add your control notification handler code here
	int       iRetVal; 
    CString   strText,strTemp;

	(CButton *)GetDlgItem(ID_START)->EnableWindow( FALSE );
	(CButton *)GetDlgItem(ID_STOP)->EnableWindow( TRUE );

	m_bStopThread = FALSE;
	m_pThread = NULL;

    m_iTotalReceive=0;
    m_iTotalTimeout=0;
    m_iThreadIndex=0;

    // get the 5000/TCP's IP Address
	GetDlgItemText(IDC_EDIT_IPADDRESS,szIPAddress,20);
    //MessageBox( szIPAddress);

    //-----  create a event for synchronization ---------------
    hEvent = CreateEvent(NULL,
			     FALSE,   // auto reset
			     FALSE,  // init state as Non-Signal
			     NULL);

    //--- adding the first 5000/TCP for streaming ----
    iRetVal=ADAMTCP_AddTCPForStream(szIPAddress);
    if( iRetVal<0 )
    {
		MessageBox("ADAMTCP_AddTCPForStream() Failure !!!");
    }

	((CListBox*)GetDlgItem(IDC_LIST_STREAM))->ResetContent();
    m_pListBox=(CListBox*)GetDlgItem(IDC_LIST_STREAM);

	if( m_pThread == NULL )
	{
		m_ThreadData.hEvent = &hEvent;
		m_ThreadData.lpStopThread = &m_bStopThread;
		m_ThreadData.TotalReceive=&m_iTotalReceive;
        m_ThreadData.TotalTimeout=&m_iTotalTimeout;
        m_ThreadData.ThreadIndex=&m_iThreadIndex;
		m_ThreadData.pListBox=m_pListBox;
  	    // Start the thread.
		m_pThread =
			AfxBeginThread(ThreadProc, (LPVOID) &m_ThreadData);
	}

    //--- only receiving sream data when an alarm occur ---
    ADAMTCP_SetStreamAlarmState(ADAMTCP_ReceiveStreamWhenAlarm);

    //--- Starting to receive the streaming data come from 5000/TCP ---
    ADAMTCP_StartStream( &hEvent);	
}

void CAlarm1Dlg::OnStop() 
{
	// TODO: Add your control notification handler code here
	HANDLE hThread = m_pThread->m_hThread;

	// Set the flag to kill the thread to TRUE;
    m_bStopThread = TRUE;

	// Wait for the thread to end.
	::WaitForSingleObject( hThread, 1000 );

    //--- Stop receiving the streaming data come from 5000/TCP ---	
	ADAMTCP_StopStream( );
    //--- Close the event handle ---
    CloseHandle(hEvent);

	(CButton *)GetDlgItem(ID_START)->EnableWindow( TRUE );
	(CButton *)GetDlgItem(ID_STOP)->EnableWindow( FALSE );

    m_iTotalReceive=0;
    m_iTotalTimeout=0;
    m_iThreadIndex=0;	
}

UINT ThreadProc( LPVOID lpParam )
{
	THREAD_DATA *lpThreadData =
		(THREAD_DATA *) lpParam;
    BOOL   *bStopThread=(BOOL*)lpParam ; 
	int    iRetVal;
    CString   strText; 
	//char   szCh[20];

	while( !(*lpThreadData->lpStopThread) )
	{
		*lpThreadData->ThreadIndex=101;
	    if(WaitForSingleObject(*lpThreadData->hEvent,1000)==WAIT_OBJECT_0)  // waiting for 1 seconds
	    { 		
			   if( (*lpThreadData->TotalReceive)%3==2 )
			   {
				   (lpThreadData->pListBox)->ResetContent();
			   }
			   (*lpThreadData->TotalReceive)++;

			   iRetVal=ADAMTCP_ReadStreamData(szIPAddress,&StreamData);
               pStreamData=(struct _StreamData *)&StreamData;

 		       strText.Format( "Receive:%d", *lpThreadData->TotalReceive);
		       (lpThreadData->pListBox)->InsertString( -1, strText );
			  
	           strText.Format ("DI/DO data of Slot0 to Slot 7:\n");
			   (lpThreadData->pListBox)->InsertString( -1, strText );
			   strText.Format("%04x:%04x:%04x:%04x-%04x:%04x:%04x:%04x\n",StreamData.DIO[0],StreamData.DIO[1],
							       StreamData.DIO[2],StreamData.DIO[3],
							       StreamData.DIO[4],StreamData.DIO[5],	
							       StreamData.DIO[6],StreamData.DIO[7]);
			   (lpThreadData->pListBox)->InsertString( -1, strText );
			   strText.Format("AI/Ao data of Slot0:\n");
			   (lpThreadData->pListBox)->InsertString( -1, strText );
               strText.Format("%04x:%04x:%04x:%04x-%04x:%04x:%04x:%04x\n",StreamData.Slot0[0],StreamData.Slot0[1],
							       StreamData.Slot0[2],StreamData.Slot0[3],
							       StreamData.Slot0[4],StreamData.Slot0[5],
							       StreamData.Slot0[6],StreamData.Slot0[7]);	
			   (lpThreadData->pListBox)->InsertString( -1, strText );
			   strText.Format("AI/AO data of Slot1:\n");
			   (lpThreadData->pListBox)->InsertString( -1, strText );
               strText.Format("%04x:%04x:%04x:%04x-%04x:%04x:%04x:%04x\n",StreamData.Slot1[0],StreamData.Slot1[1],
							       StreamData.Slot1[2],StreamData.Slot1[3],
							       StreamData.Slot1[4],StreamData.Slot1[5],
							       StreamData.Slot1[6],StreamData.Slot1[7]);			
			   (lpThreadData->pListBox)->InsertString( -1, strText );
			   //--- reading the alarm information ---
               while( (iRetVal=ADAMTCP_ReadAlarmInfo( &AlarmInfo ))==ADAMTCP_NoError )  
               {
                  strText.Format("--- getting the alarm information ---",AlarmInfo.szIP,AlarmInfo.szDateTime);
			      (lpThreadData->pListBox)->InsertString( -1, strText );
                  strText.Format("The 5000/TCP(%s) occur an alarm at %s !",AlarmInfo.szIP,AlarmInfo.szDateTime);
			      (lpThreadData->pListBox)->InsertString( -1, strText );
                  strText.Format("in Slot:%d Channel:%d  ",AlarmInfo.bySlot,AlarmInfo.byChannel);
			      (lpThreadData->pListBox)->InsertString( -1, strText );
                  strText.Format("Alarm type: %s alarm    Alarm Status: %s",(AlarmInfo.byAlarmType==1)?"High":"Low",
			  	   						      (AlarmInfo.byAlarmStatus==1)?"On":"Off");
			      (lpThreadData->pListBox)->InsertString( -1, strText );			   
               }
		}
		else
		{
			(*lpThreadData->TotalTimeout)++;
		}

	}
	(*lpThreadData->ThreadIndex)=102;
	return 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人亚洲综合a∨猫咪| av高清久久久| 国产欧美视频在线观看| 日韩欧美一二区| 欧美大尺度电影在线| 日韩欧美亚洲国产另类| 2024国产精品| 国产精品亲子乱子伦xxxx裸| 中文字幕一区二区三| 亚洲免费高清视频在线| 亚洲综合av网| 亚洲免费在线观看| 午夜久久久久久久久| 日韩精品欧美精品| 久久爱www久久做| 成人综合在线视频| 色婷婷精品久久二区二区蜜臀av| 欧美亚洲免费在线一区| 欧美日韩一区 二区 三区 久久精品 | 欧美aⅴ一区二区三区视频| 日韩电影在线免费| 国产不卡高清在线观看视频| www.亚洲色图.com| 日本高清不卡一区| 精品国产亚洲在线| 中文字幕视频一区二区三区久| 亚洲精品成人在线| 韩国v欧美v日本v亚洲v| 91小视频在线| 精品国产污网站| 国产精品视频观看| 日本欧美大码aⅴ在线播放| 国产99久久精品| 欧美一区二区网站| 亚洲欧美在线另类| 久久成人久久鬼色| 欧美熟乱第一页| 国产清纯美女被跳蛋高潮一区二区久久w| 中文字幕日韩欧美一区二区三区| 奇米777欧美一区二区| 成人av片在线观看| 精品久久久影院| 亚洲网友自拍偷拍| 成人动漫一区二区| 91精选在线观看| 亚洲精品免费电影| 国产一级精品在线| 91麻豆精品国产自产在线观看一区 | 成人午夜激情片| 欧美在线不卡视频| 国产欧美日韩在线| 久久97超碰色| 欧美浪妇xxxx高跟鞋交| |精品福利一区二区三区| 看电视剧不卡顿的网站| 色婷婷av一区二区三区大白胸 | 91污在线观看| 久久精品一区蜜桃臀影院| 亚洲aⅴ怡春院| 在线观看亚洲一区| 中文字幕一区二区三区av| 国产老肥熟一区二区三区| 91麻豆精品国产91久久久 | 色八戒一区二区三区| 国产日韩欧美一区二区三区综合| 日本大胆欧美人术艺术动态| 欧美日韩一级片在线观看| 一区二区三区四区视频精品免费 | 91.xcao| 亚洲一二三专区| 91视频com| 一区二区三区丝袜| 91在线免费看| 国产精品久久影院| 91丝袜美腿高跟国产极品老师| 国产欧美视频在线观看| 成人午夜看片网址| 中文在线一区二区| 成人精品免费视频| 亚洲国产精品精华液ab| 国产高清在线精品| 欧美国产在线观看| 国产精品自拍av| 国产欧美日韩视频一区二区| 久久66热re国产| 久久久久99精品一区| 国产一区二区三区四区五区美女 | ...xxx性欧美| 一本到不卡精品视频在线观看| 亚洲综合一区二区三区| 欧美日韩国产综合一区二区三区| 日韩av在线发布| 欧美成人乱码一区二区三区| 蜜桃视频在线观看一区| 久久亚洲综合av| 国产毛片精品一区| 一区在线观看视频| 99精品欧美一区二区三区小说| 一区二区三区久久| 欧美日韩不卡在线| 久久不见久久见免费视频7| 久久精品亚洲乱码伦伦中文| 91在线国产福利| 无吗不卡中文字幕| 久久久久久久久久美女| 91激情五月电影| 国产在线观看一区二区| 亚洲欧美偷拍三级| 制服.丝袜.亚洲.中文.综合| 免费观看在线色综合| 久久久亚洲精品一区二区三区| 99re在线视频这里只有精品| 亚洲午夜久久久久久久久电影网 | 一区二区在线观看视频在线观看| 欧美日韩不卡视频| 成人丝袜18视频在线观看| 亚洲午夜三级在线| 欧美国产精品一区二区| 欧美久久久久免费| 风流少妇一区二区| 香蕉影视欧美成人| 精品国产91亚洲一区二区三区婷婷| 成人一区二区三区视频在线观看| 亚洲国产精品一区二区久久恐怖片| 69p69国产精品| 色哟哟国产精品| 国产福利一区二区三区在线视频| 亚洲女同女同女同女同女同69| 久久综合久久综合久久综合| 欧美视频自拍偷拍| 9色porny自拍视频一区二区| 国产一区二区女| 青青草精品视频| 国产精品九色蝌蚪自拍| 日韩视频在线永久播放| 97精品超碰一区二区三区| 久久99国产乱子伦精品免费| 亚洲人成在线播放网站岛国 | 成人一二三区视频| 美女在线视频一区| 亚洲午夜久久久久久久久电影院| 中文字幕精品一区二区精品绿巨人 | 色悠久久久久综合欧美99| 国产成人无遮挡在线视频| 久久成人免费日本黄色| 日韩精品三区四区| 亚洲电影在线免费观看| 国产精品久久三区| 欧美激情一区在线观看| 久久综合av免费| 久久―日本道色综合久久| 91精品国产手机| 日韩丝袜情趣美女图片| 欧美精品日韩精品| 欧美丰满少妇xxxbbb| 91精品麻豆日日躁夜夜躁| 91精品国产91热久久久做人人| 在线综合视频播放| 久久色在线观看| 中文字幕亚洲精品在线观看| 亚洲人精品午夜| 午夜久久久影院| 青青草一区二区三区| 久久国产免费看| 国产美女av一区二区三区| 成人av电影观看| 91福利视频网站| 日韩女优制服丝袜电影| 国产欧美日韩中文久久| 亚洲精品久久久久久国产精华液| 亚洲主播在线播放| 裸体一区二区三区| 成人精品国产福利| 欧美日韩电影一区| 欧美精品一区二区久久久| 中文字幕一区日韩精品欧美| 亚洲成av人**亚洲成av**| 日本aⅴ免费视频一区二区三区| 国产伦精一区二区三区| 91猫先生在线| 欧美一级二级三级蜜桃| 国产视频不卡一区| 亚洲精品va在线观看| 另类专区欧美蜜桃臀第一页| 成人一级黄色片| 91精品久久久久久蜜臀| 国产精品久久久久久久久快鸭| 亚洲国产成人av好男人在线观看| 精品一区二区成人精品| 在线视频中文字幕一区二区| 精品蜜桃在线看| 亚洲影视资源网| 国产一区二区导航在线播放| 欧美在线999| 国产欧美日韩综合精品一区二区 | 国产精华液一区二区三区| 日本韩国一区二区三区视频| 欧美成人在线直播| 伊人开心综合网| 不卡一区二区在线|