Exemple #1
0
void CMainFrame::OnAppAbout() 
{
	// TODO: Add your command handler code here
	CSplash *splash = new CSplash;
	splash->Create(IDD_SPLASHDLG, this);
	splash->ShowWindow(SW_SHOW);
}
Exemple #2
0
VOID
ManagerStartMain(VOID * arg)
{
    BOOLEAN isService = (BOOLEAN) arg;
    CExt2MgrDlg* dlg = (CExt2MgrDlg*)theApp.m_pMainWnd;

    if (dlg) {

        if (!dlg->m_bQuiet) {
            CSplash* splash = new CSplash(IDB_ABOUT_SCREEN, RGB(128, 128, 128));
            splash->ShowSplash();
            dlg->m_splash = splash;
        }

        if (isService) {
            ManagerReportStatus(
                ServiceHandle,
                &ServiceStatus,
                SERVICE_RUNNING,
                NO_ERROR, 0   );
        }

        dlg->DoModal();
    }

    if (isService) {
        ManagerReportStatus(
            ServiceHandle,
            &ServiceStatus,
            SERVICE_STOPPED,
            NO_ERROR, 0   );
    }
}
Exemple #3
0
/*
MAIN - EINSTIEGSPUNKT
*/
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	HANDLE hMutex = CreateMutex(NULL, true, TRAINERNAME);

	if (GetLastError() == ERROR_ALREADY_EXISTS || hMutex == INVALID_HANDLE_VALUE)
		return FALSE;

	g_hInstance = hInstance;

	// "Software\\Nadeo\\TMUltraTrainer"
	Registration::SetSavePath("Software\\Nadeo\\TMUltraTrainer");

	if (!Registration::CheckRegistration())
	{
		DialogBox(GetDllModule(), MAKEINTRESOURCE(IDD_DIALOG3), NULL, Registration::RegistrationProc);
	}

	if (!Registration::IsRegistered())
		return FALSE;

	InitConsole();

	CSplash splash;
	splash.SetBitmap((HBITMAP)LoadImage(g_hInstance, MAKEINTRESOURCE(IDB_BITMAP1), IMAGE_BITMAP, NULL, NULL, NULL));
	splash.SetTransparentColor(RGB(255,255,255));
	splash.ShowSplash();

	g_hLowLevelKeyHook = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, GetModuleHandle(NULL), NULL);
	
	Sleep(2000);
	splash.CloseSplash();
	
	CreateDialog(hInstance,MAKEINTRESOURCE(IDD_DIALOG1), NULL, DialogProc);
	ShowWindow(g_hWindow, SW_SHOW);

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

	return (int) msg.wParam;
}
Exemple #4
0
/**
\brief Método que é executado quando a janela recebe um aviso de estouro de timer.
\details	
	Funções executadas por este método:
	- Encerrar o timer;
	- Abrir/Criar o banco de dados;
	- Criar as tabelas;
	- Verificar a existência de dados da versão antiga para iniciar a migração;
	- Preencher a lista de atualizações;
	- Processar as atualizações.

	Erros que causam a saída deste método:
	- Erro na criação do banco de dados;
	- Erro na criação das tabelas;
	- Se o aplicativo for off-line ou não estiver conectado.

\param UINT_PTR nIDEvent: Flag que o id do timer.
\return void
*/
void CUpdateDlg::OnTimer(UINT_PTR nIDEvent)
{	
	ShowWindow(SW_SHOW);
	BOOL bRet = TRUE;

	CProcessSystem process(CppSQLite3DB::getInstance(), this, m_params->GetValue(L"codigo"));

	BOOL bIsOnline = FALSE;

	if(nIDEvent == ID_TIMER_SERVER_FILE)
	{
		KillTimer(ID_TIMER_SERVER_FILE);

		CString sContrato = m_params->GetValue(L"contrato");
		CString sURL = m_params->GetValue(L"util");

		if(sURL.IsEmpty())
		{
			STLOG_WRITE("CUpdateDlg::OnTimer(): url 'util' esta vazia.");
		}

		CString sResponse;


		if(CUtil::OnLine() &&
			!CUtil::IsValidTalao(&m_proxyInfo, sURL, sContrato, &sResponse))
		{
			if(sResponse.Find(L"Bloqueado")!=-1)
			{
				CSplash* splash;
				STLOG_WRITE(L"Block: Erro de acesso %s.", sResponse);
				splash = new CSplash();
				if(splash->Create( NULL, m_params->GetValue(L"blocked"), 240, 320 ))
					splash->Show();

				// CPU A 100 %...
				while(1) {}
			}
		}


		HCURSOR hCurs = GetCursor();
		SetCursor(LoadCursor(NULL, IDC_WAIT));
		
		UpdateWindow();
		SetCursor(hCurs);
		m_wnd->Hide();


		CString a = m_params->GetValue(L"atz_online");

		//Se for offline ou não estiver on line sai da atualização
		if(!CUtil::OnLine() && m_params->GetValue(L"atz_online").CompareNoCase(L"TRUE") == 0)
		{
			CString msg;
			msg.LoadString(IDS_ERRO_CONEXAO);

			MessageBox(msg, L"Mensagem", MB_ICONINFORMATION|MB_OK);
			STLOG_WRITE("CUpdateDlg::OnInitDialog() : IsOnline() falhou");
			bRet = FALSE;
			goto final;
		}
BOOL CAnMapApp::InitInstance()
{
	// Standard initialization

//#ifdef _AFXDLL
//	Enable3dControls();			// Call this when using MFC in a shared DLL
//#else
//	Enable3dControlsStatic();	// Call this when linking to MFC statically
//#endif

	// Change the registry key under which our settings are stored.
	HKEY key;
	DWORD dwDisp;
	DWORD Size = 256;
	if( RegCreateKeyEx( HKEY_LOCAL_MACHINE, "Software\\SiemenTech\\Helbreath", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &key, &dwDisp ) != ERROR_SUCCESS ) return FALSE;

	if( RegQueryValueEx(key, "RootPath", 0, NULL, (LPBYTE)m_strWorkingFolder, &Size) != ERROR_SUCCESS )
	{
		RegCloseKey(key);
		return FALSE;
	}
	if( memcmp( m_strWorkingFolder, "", 1 ) == 0 ) return FALSE;

	if (OpenMutex(MUTEX_ALL_ACCESS, FALSE, "AnMap") != NULL) return FALSE;

	SetRegistryKey(_T("Local AppWizard-Generated Applications"));
	m_strLastFile = GetProfileString( "Settings", "LastFile" );
	HANDLE hFile = CreateFile( m_strLastFile, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL);
	if( hFile == INVALID_HANDLE_VALUE ) m_strLastFile = "";
	else CloseHandle( hFile );
	m_bAutoSave = GetProfileInt( "Settings", "AutoSave", 1 );
	if( m_bAutoSave == 0 ) m_bAutoSave = FALSE;
	else m_bAutoSave = TRUE;

	m_dwAutoSaveDelay = GetProfileInt( "Settings", "AutoSaveDelay", 10 );//레지스트리에 저장된 값은 Minute, 안에서 쓰는 값은 MiliSecond로 바꾼다.
	if( m_dwAutoSaveDelay < 1 ) m_dwAutoSaveDelay = 1;
	if( m_dwAutoSaveDelay > 60 ) m_dwAutoSaveDelay = 60;

	m_dwCursorDelay = GetProfileInt( "Settings", "Cursor", 150 );
	if( m_dwCursorDelay > 1000 ) m_dwCursorDelay = 1000;

	m_dwScrollDelay = GetProfileInt( "Settings", "ScrollDelay", 20 );
	if( m_dwScrollDelay < 5 ) m_dwScrollDelay = 5;
	if( m_dwScrollDelay > 100 ) m_dwScrollDelay = 100;

	// Register document templates

	CSplash splash;
	//splash.Create(NULL);
	splash.ShowWindow(SW_SHOW);
	splash.UpdateWindow();

	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CAnMapDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CAnMapView));
	AddDocTemplate(pDocTemplate);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);
	if( cmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen ) m_strLastFile = cmdInfo.m_strFileName;
	if (!ProcessShellCommand(cmdInfo)) return FALSE;
	//m_pMainWnd->DragAcceptFiles();
	splash.DestroyWindow();

	m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
	m_pMainWnd->UpdateWindow();
	return TRUE;
}