Exemplo n.º 1
0
void CSiemensSR::SendClose()
{

	if (!IsConnected ())
	{
		MSGERROR ("CSiemensSR::SendClose () No Conectado");
		CAlarma * ptrAlarma = new CAlarma;
		ptrAlarma->AvisarAlarma (6,4,0);
		return; 
	}
	Process (DO_CLOSE);

}
Exemplo n.º 2
0
void RegisterOptPrevBox()
{
	DWORD err;
	WNDCLASSEX wcl;
	wcl.cbSize = sizeof(wcl);
	wcl.lpfnWndProc = (WNDPROC)BoxPreviewWndProc;
	wcl.style = CS_DROPSHADOW;
	wcl.cbClsExtra = 0;
	wcl.cbWndExtra = 0;
	wcl.hInstance = hInst;
	wcl.hIcon = NULL;
	wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
	wcl.hbrBackground = NULL; //(HBRUSH)GetStockObject(LTGRAY_BRUSH);
	wcl.lpszMenuName = NULL;
	wcl.lpszClassName = _T(BOXPREVIEW_WNDCLASS);
	wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
	g_wndClass.cPopupPreviewBoxWndclass = RegisterClassEx(&wcl);
	err = GetLastError();
	if (!g_wndClass.cPopupPreviewBoxWndclass) {
		TCHAR msg[1024];
		mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName);
		MSGERROR(msg);
	}

	// register custom class for dialog box with drop-shadow attribute
	// "#32770" stays for class name of default system dialog box
	GetClassInfoEx(hInst, _T("#32770"), &wcl);
	wcl.hInstance = hInst;
	wcl.lpszClassName = _T("PopupPlusDlgBox");
	wcl.style |= CS_DROPSHADOW;
	g_wndClass.cPopupPlusDlgBox = RegisterClassEx(&wcl);
	err = GetLastError();
	if (!g_wndClass.cPopupPlusDlgBox) {
		TCHAR msg[1024];
		mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName);
		MSGERROR(msg);
	}
}
Exemplo n.º 3
0
// Enviar un telegrama al PLC
void CSiemensSR::SendTelegrama(BYTE tipoTel, BYTE *ptrDatos, WORD len)
{
	if (!IsConnected ())
	{
		MSGERROR ("CSiemensSR::SendTelegrama () No Conectado");
		CAlarma * ptrAlarma = new CAlarma;
		ptrAlarma->AvisarAlarma (6,4,0);
		return; // Michael: XXX ver que hacer 27.11.2001
		// Process(DO_OPEN);
	}
	m_SendBuf [0] = tipoTel;
	memcpy (m_SendBuf + 1, ptrDatos, len);
	m_DataLen = len + 1;	// Len es tamaño datos solo
	Process (DO_SEND_EOM);

}
Exemplo n.º 4
0
// Enviar el estado al PLC
void CSiemensSR::SendEstado(BYTE *ptrDatos)
{
	if (!IsConnected ())
	{
		MSGERROR ("CSiemensSR::SendEstado () No Conectado");
		CAlarma * ptrAlarma = new CAlarma;
		ptrAlarma->AvisarAlarma (6,4,0);
		return; // Michael: XXX ver que hacer 27.11.2001
		// Process(DO_OPEN);
	}
	memcpy (m_SendBuf, ptrDatos, MAXESTADOSENDPLC);
	m_DataLen = MAXESTADOSENDPLC;
	MSGTRACE("CSiemensSR::SendEstado(). Before Process");
	Process (DO_SEND_EOM);
	MSGTRACE("CSiemensSR::SendEstado(). After Process");
	delete ptrDatos;
}
Exemplo n.º 5
0
//  thread func
static unsigned __stdcall PopupThread(void *)
{
	Thread_SetName("Popup: PopupThread");

	//  Create manager window
	DWORD err;
	WNDCLASSEX wcl;
	wcl.cbSize = sizeof(wcl);
	wcl.lpfnWndProc = PopupThreadManagerWndProc;
	wcl.style = 0;
	wcl.cbClsExtra = 0;
	wcl.cbWndExtra = 0;
	wcl.hInstance = hInst;
	wcl.hIcon = NULL;
	wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
	wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
	wcl.lpszMenuName = NULL;
	wcl.lpszClassName = _T("PopupThreadManagerWnd");
	wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
	g_wndClass.cPopupThreadManagerWnd = RegisterClassEx(&wcl);
	err = GetLastError();
	if (!g_wndClass.cPopupThreadManagerWnd) {
		TCHAR msg[1024];
		mir_sntprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
		MSGERROR(msg);
	}

	gHwndManager = CreateWindow(_T("PopupThreadManagerWnd"), NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL);
	SetWindowPos(gHwndManager, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);

	MSG msg;
	while (GetMessage(&msg, NULL, 0, 0)) {
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	DestroyWindow(gHwndManager); gHwndManager = NULL;
	return 0;
}
Exemplo n.º 6
0
void ErrorMSG(int minValue, int maxValue)
{
	TCHAR str[128];
	mir_sntprintf(str, SIZEOF(str), TranslateT("You cannot specify a value lower than %d and higher than %d."), minValue, maxValue);
	MSGERROR(str);
}
Exemplo n.º 7
0
bool	LoadPopupWnd2()
{
	bool res = true;

	WNDCLASSEX wcl = { 0 };
	wcl.cbSize = sizeof(wcl);
	wcl.lpfnWndProc = PopupWnd2::WindowProc;
	wcl.hInstance = hInst;
	wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
	wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
	wcl.lpszClassName = _T(POPUP_WNDCLASS);
	wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
	g_wndClass.cPopupWnd2 = RegisterClassEx(&wcl);
	DWORD err = GetLastError();
	if (!g_wndClass.cPopupWnd2) {
		res = false;
		TCHAR msg[1024];
		mir_sntprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
		MessageBox(NULL, msg, _T(MODULNAME_LONG), MB_ICONSTOP | MB_OK);
	}

	WNDCLASSEX wclw = { 0 };
	wclw.cbSize = sizeof(wclw);
	if (!GetClassInfoEx(NULL, _T("EDIT"), &wclw))
		MSGERROR(TranslateT("Failed to GetClassInfoExW from EDIT class."));
	wclw.hInstance = hInst;
	wclw.lpszClassName = _T("PopupEditBox");
	wclw.style |= CS_DROPSHADOW;
	g_wndClass.cPopupEditBox = RegisterClassEx(&wclw);
	err = GetLastError();
	if (!g_wndClass.cPopupEditBox) {
		TCHAR msg[2048];
		mir_sntprintf(msg, TranslateT("Failed to register custom edit box window class.\r\n\r\ncbSize: %i\r\nstyle: %p\r\nlpfnWndProc: %i\r\ncbClsExtra: %i\r\ncbWndExtra: %i\r\nhInstance: %i\r\nhIcon: %i\r\nhCursor: %i\r\nhbrBackground: %i\r\nlpszMenuName: %s\r\nlpszClassName: %s\r\nhIconSm: %i\r\n"),
			wclw.cbSize, wclw.style, wclw.lpfnWndProc, wclw.cbClsExtra, wclw.cbWndExtra, wclw.hInstance, wclw.hIcon, wclw.hCursor,
			wclw.hbrBackground, wclw.lpszMenuName, wclw.lpszClassName, wclw.hIconSm);

		MSGERROR(msg);
	}

	memset(&wcl, 0, sizeof(wcl));
	wcl.cbSize = sizeof(wcl);
	wcl.lpfnWndProc = MenuHostWndProc;
	wcl.style = 0;
	wcl.cbClsExtra = 0;
	wcl.cbWndExtra = 0;
	wcl.hInstance = hInst;
	wcl.hIcon = NULL;
	wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
	wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
	wcl.lpszMenuName = NULL;
	wcl.lpszClassName = _T("PopupMenuHostWnd");
	wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
	g_wndClass.cPopupMenuHostWnd = RegisterClassEx(&wcl);
	err = GetLastError();
	if (!g_wndClass.cPopupMenuHostWnd) {
		res = false;
		TCHAR msg[1024];
		mir_sntprintf(msg, TranslateT("Failed to register %s class."), wcl.lpszClassName);
		MSGERROR(msg);
	}

	ghwndMenuHost = CreateWindow(_T("PopupMenuHostWnd"), NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL);
	SetWindowPos(ghwndMenuHost, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);

	INITCOMMONCONTROLSEX iccex;
	iccex.dwICC = ICC_WIN95_CLASSES;
	iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
	InitCommonControlsEx(&iccex);

	res = res && ghwndMenuHost;

	return res;
}