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

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

?? itkplcdlg.cpp

?? 工業強度的PLC模擬程序
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
	//
	this->ShowWindow(SW_HIDE);
	
	//
	// If Timers are being used, then free up that timer as well
	//
	if (this->IsUsingTimers())
	{
		KillTimer(REGISTER_TIMER);
	}

	//
	// If we are sending unsolicited messages, wait for both threads
	// to expire. If not, wait for just the IO thread.
	//
	if (this->m_hUnsolThread)
	{
		HANDLE	hArray[2] = { this->m_hIoThread, this->m_hUnsolThread };


		this->m_bShutdown = TRUE;
		SetEvent(this->m_hNotifyEvt);

		WaitForMultipleObjects(2,
							   hArray,
							   TRUE,
							   FIVE_SECONDS);
	}
	else
	{
		WaitForSingleObject(this->m_hIoThread, FIVE_SECONDS);
	}

	//
	//  Free the critical section
	//
	DeleteCriticalSection(&this->m_Lock);

	CDialog::OnOK();
}



//----(Member Function)-------------------------------------------------------
//
// @mfunc void | CItkPlcDlg | OnTriggers |
//
// Called when the user clicks the Timers button. This handler performs
// the DoModal() for the CTriggerDlg object.
//
void CItkPlcDlg::OnTriggers() 
{
	UINT	nTempRefresh;


	m_pdlgTriggers->m_nCurrentRefreshRate = this->m_nTimerRefreshRate;

	if (m_pdlgTriggers->DoModal() == IDOK)
	{
		m_pdlgTriggers->GetTimerMap((int *)&this->m_nTimerMap);
		nTempRefresh = this->m_nTimerRefreshRate;
		this->m_nTimerRefreshRate = m_pdlgTriggers->GetRefreshRate();

		//
		// If there are timers in the timer map, then get a Timer
		// from the system to process them.
		//
		if (m_pdlgTriggers->GetNumTimers() > 0)
		{
			//
			// If we are currently using timers, kill the current and
			// create a new one for the new refresh rate
			//
			if ((this->IsUsingTimers()) && 
				(nTempRefresh != this->m_nTimerRefreshRate))
			{
				KillTimer(REGISTER_TIMER);
				SetTimer(REGISTER_TIMER, this->m_nTimerRefreshRate, NULL);
			}
			else if (!this->IsUsingTimers())
			{			
				SetTimer(REGISTER_TIMER, this->m_nTimerRefreshRate, NULL);
			}

			this->IsUsingTimers(TRUE);
		}
		else
		{
			//
			// If we are currently using timers, then free the timer
			// to the system because we don't need it
			//
			if (this->IsUsingTimers())
			{
				KillTimer(REGISTER_TIMER);
			}

			this->IsUsingTimers(FALSE);
		}
	}
}



//----(Member Function)-------------------------------------------------------
//
// @mfunc void | CItkPlcDlg | OnSettingsButton |
//
// Called when the user clicks the Settings button. This handler performs
// the DoModal() for the CSettingsDlg object. It also initializes the objects
// members 
//
void CItkPlcDlg::OnSettingsButton() 
{
	BOOL	bOldUnsol = this->m_bUnsolicited;


	if (IDOK == m_pdlgSettings->DoModal())
	{
		this->m_bUnsolicited = m_pdlgSettings->GetSendUnsol();
		this->m_dwRemoteStation = m_pdlgSettings->GetRemoteStation();
		this->m_dwLocalStation = m_pdlgSettings->GetLocalStation();
		this->m_dwUnsolFrequency = m_pdlgSettings->GetUnsolFrequency();
		this->m_bSourceStn = m_pdlgSettings->IsUsingSourceStation();
		this->m_bTransNum = m_pdlgSettings->IsUsingTransactionNumbers();

		if (m_pdlgSettings->IsSerial())
		{
			this->m_dwProtocol = SERIAL_PROTOCOL;
			this->m_szPortName = m_pdlgSettings->GetPortName();
			this->m_szPortMode = m_pdlgSettings->GetPortMode();
			this->GetBCCMask();
		}
		else if (m_pdlgSettings->IsUdpIp())
		{
			this->m_dwProtocol = UDPIP_PROTOCOL;
			this->m_szIpAddress = m_pdlgSettings->GetIpAddress();
			this->m_uPortNumber = m_pdlgSettings->GetPortNumber();
		}
		else
		{
			this->m_dwProtocol = TCPIP_PROTOCOL;
			this->m_szIpAddress = m_pdlgSettings->GetIpAddress();
			this->m_uPortNumber = m_pdlgSettings->GetPortNumber();
		}

		//
		// Check to see if we were not using unsolicited, but now we are
		//		OR
		// we were using unsolicited, but not now.
		//
		if (!bOldUnsol && this->m_bUnsolicited)
		{
			this->m_bShutdown = TRUE;
			SetEvent(this->m_hNotifyEvt);

			WaitForSingleObject(this->m_hIoThread, FIVE_SECONDS);

			this->m_hIoThread = NULL;
		}
		else if (bOldUnsol && !this->m_bUnsolicited)
		{
			HANDLE	hArray[2] = { this->m_hIoThread, this->m_hUnsolThread };


			this->m_bShutdown = TRUE;
			SetEvent(this->m_hNotifyEvt);

			WaitForMultipleObjects(2,
								   hArray,
								   TRUE,
								   FIVE_SECONDS);

			this->m_hIoThread = NULL;
			this->m_hUnsolThread = NULL;
		}

		//
		// Kick off the thread that actually does all the work. It will
		// create the unsolicited thread, if necessary.
		//
		this->m_bShutdown = FALSE;
		if (NULL == this->m_hIoThread)
		{
			DWORD	dwIoThreadId = 0;
			this->m_hIoThread = CreateThread(NULL,
							 				 0,
											 (LPTHREAD_START_ROUTINE)IoHandler, 
											 (LPVOID)this, 
											 0, 
											 &dwIoThreadId); 
		}
	}
}



//----(Member Function)-------------------------------------------------------
//
// @mfunc void | CItkPlcDlg | OnShowStats |
//
// Displays and hides a modeless dialog box with the communications 
// statistics for the ITKPLC.
//
void CItkPlcDlg::OnShowStats() 
{
	if (FALSE == m_pdlgCommStats->m_bDisplayed)
	{
		m_pdlgCommStats->Create();

		//
		// Change the text on the button
		//
		SetDlgItemText(IDC_SHOW_STATS, "Hide Stats");
	}
	else
	{
		m_pdlgCommStats->CloseDialog();

		//
		// Change the text on the button
		//
		SetDlgItemText(IDC_SHOW_STATS, "Show Stats");
	}
}



//----(Member Function)-------------------------------------------------------
//
// @mfunc void | CItkPlcDlg | OnDblclkPlcData |
//
// Called when the user double clicks in the PLC Memory Map window. This
// function determines which row was clicked and performs a DoModal for a
// CPlcMemDlg object. This object then allows the user to enter data to
// be written to the memory map of the PLC. It then updates the row and calls
// OnPaint to update the screen.
//
void CItkPlcDlg::OnDblclkPlcData() 
{
	int			nLoc;

	CPlcMemDlg	dlgPlcMem;

	CString		csDlgText;

	ChangedVal	*ChangedValuesMap;

	BOOL		bChangedFlag = FALSE;


	//
	// Get the row number that the user clicked on...
	//
	nLoc = m_DataList.GetCurSel();
	
	//
	// ...Pass that to the CPlcMemDlg object
	//
	dlgPlcMem.SetLocation(nLoc);

	if (dlgPlcMem.DoModal() != IDOK)
	{
		return;
	}

	//
	// Return a ChangedVal structure array containing what was changed
	//
	ChangedValuesMap = dlgPlcMem.GetChangedValues();

	//
	// Loop through the Changed Value array. If a value was modified,
	// then write it to the PLC memory map. If it didn't change, then
	// don't change the memory map.
	//
	for (int nOffset = 0; nOffset < REGISTERS_PER_ROW; nOffset++)
	{
		if (ChangedValuesMap[nOffset].bChanged == TRUE)
		{
			PlcMemory[nLoc*10 + nOffset] = ChangedValuesMap[nOffset].nNewVal;
			bChangedFlag = TRUE;
		}
	}

	//
	// Update the row in the memory map if anything changed
	//
	if (bChangedFlag)
	{
		this->UpdateRow(nLoc);

		//
		// Repaint the window
		//
		CDialog::OnPaint();
	}

	//
	// Set the focus back to the current row
	//
	m_DataList.SetCurSel(nLoc);
}



//----(Member Function)-------------------------------------------------------
//
// @mfunc void | CItkPlcDlg | OnDatatypeAscii |
//
// Called when the user clicks the ASCII datatype view. This will set the view
// of the ITK PLC memory map to ASCII format with bytes swapped!!
//

void CItkPlcDlg::OnDatatypeAscii() 
{
	int nRow = 0;
	
	
	if (m_datatype == DT_ASCII)
	{
		//
		// Nothing has changed
		//
		return;
	}

	this->SetDlgItemText(IDC_REGISTER_LABELS, "  0      1      2      3      4      5      6      7      8      9");

	m_datatype = DT_ASCII;

	UpdateData(FALSE);
	
	//
	// Update the memory map with the new format
	//
	this->UpdateMemoryMap();	
}



//----(Member Function)-------------------------------------------------------
//
// @mfunc void | CItkPlcDlg | OnDatatypeFloat |
//
// Called when the user clicks the Float datatype view. This will set the view
// of the ITK PLC memory map to IEEE float format.
//
void CItkPlcDlg::OnDatatypeFloat() 
{
	int nRow = 0;


	if (m_datatype == DT_FLOAT)
	{
		//
		// Nothing has changed
		//
		return;
	}

	this->SetDlgItemText(IDC_REGISTER_LABELS, "       0             2              4              6               8");

	m_datatype = DT_FLOAT;

	UpdateData(FALSE);

	//
	// Update the memory map with the new format
	//
	this->UpdateMemoryMap();
}



//----(Member Function)-------------------------------------------------------
//
// @mfunc void | CItkPlcDlg | OnDatatypeHex |
//
// Called when the user clicks the Hex datatype view. This will set the view
// of the ITK PLC memory map to a 16-bit Hexadecimal format.
//
void CItkPlcDlg::OnDatatypeHex() 
{
	int nRow = 0;
	
	
	if (m_datatype == DT_HEX)
	{
		//
		// Nothing has changed
		//
		return;
	}

	this->SetDlgItemText(IDC_REGISTER_LABELS, "  0      1      2      3      4      5      6      7      8      9");

	m_datatype = DT_HEX;

	UpdateData(FALSE);
	
	//
	// Update the memory map with the new format
	//
	this->UpdateMemoryMap();
}



//----(Member Function)-------------------------------------------------------
//
// @mfunc void | CItkPlcDlg | OnDatatypeLong |
//
// Called when the user clicks the Long datatype view. This will set the view
// of the ITK PLC memory map to unsigned 32-bit integer format.
//
void CItkPlcDlg::OnDatatypeLong() 
{
	int nRow = 0;


	if (m_datatype == DT_LONG)
	{
		//
		// Nothing has changed
		//
		return;
	}

	this->SetDlgItemText(IDC_REGISTER_LABELS, "       0             2              4              6               8");

	m_datatype = DT_LONG;

	UpdateData(FALSE);	

	//
	// Update the memory map with the new format
	//
	this->UpdateMemoryMap();
}



//----(Member Function)-------------------------------------------------------
//
// @mfunc void | CItkPlcDlg | OnDatatypeSigned |
//
// Called when the user clicks the Signed datatype view. This will set the view
// of the ITK PLC memory map to signed integer format.
//
void CItkPlcDlg::OnDatatypeSigned() 
{
	int nRow = 0;


	if (m_datatype == DT_SIGNED)
	{
		//
		// Nothing has changed
		//
		return;
	}

	this->SetDlgItemText(IDC_REGISTER_LABELS, "  0      1      2      3      4      5      6      7      8      9");

	m_datatype = DT_SIGNED;

	UpdateData(FALSE);	

	//
	// Update the memory map with the new format
	//
	this->UpdateMemoryMap();
}



//----(Member Function)-------------------------------------------------------
//
// @mfunc void | CItkPlcDlg | OnDatatypeUnsigned |
//
// Called when the user clicks the Unsigned datatype view. This will set the view
// of the ITK PLC memory map to unsigned integer format.
//
void CItkPlcDlg::OnDatatypeUnsigned() 
{
	int nRow = 0;


	if (m_datatype == DT_UNSIGNED)
	{
		//
		// Nothing has changed
		//
		return;
	}

	this->SetDlgItemText(IDC_REGISTER_LABELS, "  0      1      2      3      4      5      6      7      8      9");

	m_datatype = DT_UNSIGNED;

	UpdateData(FALSE);

	//
	// Update the memory map with the new format
	//
	this->UpdateMemoryMap();
}



//----(Member Function)-------------------------------------------------------
//
// @mfunc void | CItkPlcDlg | UpdateMemoryMap |
//
// Updates the entire memory map.
//
void CItkPlcDlg::UpdateMemoryMap(unsigned char cClear /* default is FALSE */)
{
	unsigned int	nRow = 0,
					nReg = 0;


	switch(cClear)
	{
	case CLEAR_MEMORY:
		//
		// Set the memory map to 0. 
		// We multiply by 2 because memset clears bytes, not words.
		//
		memset(this->PlcMemory, 0, PLC_MEMORY_SIZE * 2);
		break;

	case SET_MEMORY:
		//
		//  Set the data array to equal there register number
		//
		for (nReg = 0; nReg < PLC_MEMORY_SIZE; nReg++ )
		{
			this->PlcMemory[nReg] = nReg;
		}
		break;

	case UPDATE_ONLY:
	default:
		break;
	}

	while (nRow <= NUM_ROWS)
	{
		this->UpdateRow(nRow);
		nRow++;
	}
}



?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美视频在线观看| 欧美日韩一区视频| 午夜影院久久久| 亚洲免费大片在线观看| 中文在线一区二区| 中文在线一区二区| 中文在线免费一区三区高中清不卡| www亚洲一区| 日韩欧美国产不卡| 日韩欧美卡一卡二| 日韩欧美专区在线| 欧美videos中文字幕| 欧美一级淫片007| 日韩一区二区在线观看视频播放| 在线观看免费亚洲| 欧美欧美欧美欧美| 日韩无一区二区| 久久综合色婷婷| 国产亚洲污的网站| 中文字幕亚洲视频| 亚洲色图欧美偷拍| 午夜精品一区二区三区三上悠亚| 亚洲.国产.中文慕字在线| 视频一区欧美精品| 紧缚奴在线一区二区三区| 国产福利一区二区三区在线视频| 国产精品一品二品| av激情综合网| 欧美视频精品在线观看| 日韩一区国产二区欧美三区| www日韩大片| 亚洲你懂的在线视频| 婷婷六月综合网| 国产在线精品一区二区夜色| 成人黄色在线网站| 欧美精品精品一区| 国产欧美日韩不卡免费| 亚洲欧美一区二区三区国产精品| 亚洲成人激情社区| 国产一区二区久久| 日本精品视频一区二区| 欧美大片顶级少妇| 亚洲欧洲精品一区二区精品久久久| 亚洲h动漫在线| 国产精华液一区二区三区| 色综合久久天天综合网| 日韩一区二区免费高清| 亚洲欧美日韩国产一区二区三区| 日本亚洲最大的色成网站www| 国产大陆a不卡| 欧美另类久久久品| 国产精品短视频| 久久精品国产亚洲一区二区三区| 99riav久久精品riav| 欧美大胆人体bbbb| 亚洲高清在线视频| 99国产欧美另类久久久精品| 日韩美一区二区三区| 樱花草国产18久久久久| 国产91丝袜在线18| 日韩欧美成人激情| 一区二区三区蜜桃网| 成人黄色小视频| 欧美xxxxxxxxx| 日韩在线播放一区二区| 色噜噜狠狠一区二区三区果冻| 久久日韩精品一区二区五区| 五月综合激情日本mⅴ| 99精品1区2区| 中文字幕一区在线观看| 国产在线精品免费| 欧美岛国在线观看| 久久99精品视频| 7777精品伊人久久久大香线蕉完整版| 亚洲欧美区自拍先锋| 懂色av一区二区三区免费看| 久久久久综合网| 激情综合网av| www成人在线观看| 国内不卡的二区三区中文字幕 | 欧美一区二区人人喊爽| 亚洲成人av电影| 在线观看亚洲成人| 亚洲精品成人少妇| 欧亚洲嫩模精品一区三区| 一区二区在线免费观看| 色欧美日韩亚洲| 亚洲美女视频一区| 欧美亚洲国产bt| 午夜一区二区三区在线观看| 欧美日韩精品一区二区在线播放| 一区二区高清在线| 欧美区视频在线观看| 日日摸夜夜添夜夜添精品视频| 欧美日韩国产影片| 日本中文在线一区| 久久综合网色—综合色88| 国产二区国产一区在线观看| 国产精品免费视频观看| 91激情在线视频| 午夜av一区二区| 日韩精品一区二区三区在线播放| 午夜成人免费视频| 久久综合久久综合久久综合| 99久久国产综合精品女不卡| 香蕉乱码成人久久天堂爱免费| 欧美精品一区二区久久久| aaa欧美大片| 日本麻豆一区二区三区视频| 久久网站热最新地址| 91黄视频在线| 国产九色精品成人porny| 亚洲精品第一国产综合野| 欧美伊人久久大香线蕉综合69| 免费的成人av| 亚洲人成亚洲人成在线观看图片| 欧美人与性动xxxx| 国产福利一区在线| 日韩不卡一二三区| 国产精品福利电影一区二区三区四区| 成人综合婷婷国产精品久久免费| 日本一区二区三区高清不卡| 成人午夜在线视频| 欧美日本一区二区在线观看| 精油按摩中文字幕久久| 国产午夜精品一区二区| 蜜臀av在线播放一区二区三区 | 亚洲欧美成aⅴ人在线观看| 国内精品不卡在线| 国产精品水嫩水嫩| eeuss鲁片一区二区三区 | 蜜臀av在线播放一区二区三区| 欧美一区二区三区日韩| 精品一区二区在线视频| 国产精品网站在线观看| 91麻豆国产精品久久| 视频一区二区三区在线| 色综合久久久久综合99| 亚洲免费视频成人| 欧美精品1区2区| 国产一区 二区 三区一级| 欧美激情中文不卡| 欧美性生活影院| 久久国产精品色婷婷| 日本久久电影网| 久久99精品国产.久久久久| 中文av一区特黄| 99国产精品国产精品毛片| 欧美高清在线视频| 在线欧美一区二区| 免播放器亚洲一区| 免费在线观看一区二区三区| 国产精品麻豆一区二区| 欧美日韩免费一区二区三区视频| 国产在线国偷精品免费看| 午夜在线电影亚洲一区| 欧美经典三级视频一区二区三区| 91超碰这里只有精品国产| 粉嫩aⅴ一区二区三区四区五区| 亚洲日本一区二区| 国产欧美日韩精品一区| 99久久精品久久久久久清纯| 美女高潮久久久| 亚洲美女淫视频| 国产精品久久久久婷婷二区次| 欧美一级日韩免费不卡| 91免费观看在线| 国产在线不卡一区| 看片的网站亚洲| 图片区小说区区亚洲影院| 专区另类欧美日韩| 欧美国产一区二区| 国产亚洲精品资源在线26u| 欧美精品国产精品| 在线亚洲一区观看| 欧美性高清videossexo| 成人国产精品免费观看动漫| 久久 天天综合| 图片区小说区区亚洲影院| 亚洲不卡av一区二区三区| 亚洲免费在线电影| 日韩视频免费观看高清完整版在线观看| 欧美成人bangbros| 欧美精品在线一区二区| 在线一区二区视频| 欧美日韩国产美| 欧美日韩午夜精品| 欧美日韩aaaaa| 欧美日韩中文国产| 97超碰欧美中文字幕| 欧美日韩高清一区二区| 欧美日韩色一区| 欧美视频精品在线| 69av一区二区三区| 3d动漫精品啪啪1区2区免费 | 日韩一区精品字幕| 丝袜美腿亚洲色图| 亚洲一区二区在线视频| 一色屋精品亚洲香蕉网站| 亚洲人成网站精品片在线观看|