void CTransportSession::Shutdown()
	{
	LOG_FUNC
	iSAPShutdown = ENormal;
	// and proceed normally - we now own ourselves...
	DoShutdown();
	}
void CTransportSession::FastShutdown()
	{
	LOG_FUNC
	// just note whether we need to tell sap later or now to close
	iSAP.DetachSession();
	
	iSAPShutdown = EImmediate;
	// and proceed normally - we now own ourselves...
	DoShutdown();
	}
Exemple #3
0
void CALLBACK TimerProc( HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime )
{
	if( idEvent == TIMER )
	{
		if( checkConfig.checkProcess && !ProcessExist( TARGET_NAME ) )
		{
			DoShutdown( hWnd, 1 );
		}
		else if( checkConfig.checkNet && !ProcessTcpExist( TARGET_NAME ) )
		{
			DoShutdown( hWnd, 2 );
		}
		else
		{
			char info[512];
			sprintf( info, "%sН§н┌н╦лл", TARGET_NAME );
			SetWindowText( hWnd, info );
		}
	}
}
DWORD WINAPI CountdownThread(LPVOID lpParameter)
{
	HWND hwnd = FindWindow("TimerCron", NULL);
	PlanInfo *plan = (PlanInfo *)lpParameter;
	CString CountdownTips;
	DoCountdown *Countdown = new DoCountdown(plan->PlanSecond);
	while (true)
	{   

		CountdownTips.Format("%s : %s : %s", Countdown->GetStrHour(), Countdown->GetStrMinute(), Countdown->GetStrSecond());
		::PostMessage(hwnd, WM_GET_COUNTDOWN, (WPARAM)CountdownTips.GetBuffer(), NULL);
		if (*Countdown)
		{	
			DoShutdown();
			break;
		}
		*Countdown - 1;
		Sleep(1000);
	}
	return 0;
}
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdShow)
{
    WNDCLASSEX wcex;
    MSG        Msg;
    HWND       hWnd;

    // Initialize the COM system
    CoInitialize(NULL);

    // Create the window class here and register it
    wcex.cbSize        = sizeof(wcex);
    wcex.style         = CS_CLASSDC;
    wcex.lpfnWndProc   = WindowProc;
    wcex.cbClsExtra    = 0;
    wcex.cbWndExtra    = 0;
    wcex.hInstance     = hInst;
    wcex.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wcex.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground = NULL;
    wcex.lpszMenuName  = NULL;
    wcex.lpszClassName = g_szClass;
    wcex.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);
    if(!RegisterClassEx(&wcex))
        return FALSE;

    // Create the main window
    hWnd = CreateWindow(g_szClass, g_szCaption,
                        WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
                        0, 0, 640, 480,
                        NULL, NULL, hInst, NULL);
    if(!hWnd)
        return FALSE;
    ShowWindow(hWnd, SW_NORMAL);
    UpdateWindow(hWnd);

    // Call init function and enter message pump
    if(DoInit(hWnd) == TRUE) {

        // Start message pump, waiting for user to exit
        ZeroMemory(&Msg, sizeof(MSG));
        while(Msg.message != WM_QUIT) {
            if(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {
                TranslateMessage(&Msg);
                DispatchMessage(&Msg);
            }

            // Render a single frame
            DoFrame();
        }
    }

    // Call shutdown
    DoShutdown();

    // Unregister the window class
    UnregisterClass(g_szClass, hInst);

    // Shut down the COM system
    CoUninitialize();

    return 0;
}
/*
 * OutOfMem()
 *
 * Called when a memory allocation attempt has failed - make a log entry
 * and a core file to work with
 */
void OutOfMem()
{
  putlog(LOG1, "Out of Memory, shutting down");
  DoShutdown(NULL, "Out of Memory");
} /* OutOfMem() */