Exemple #1
0
void CBTHmiDlg::CloseHMIVidio()
{
	/*if(m_ctStateManage.IsActive())
	{
		m_ctStateManage.StopTimer();
	}*/
	CloseCheckHandle();
#ifdef  TESTBTCOMMANDQUEUE
	//CBTCommand::Instance()->SendBTCommandBlockToQueue(BTPacketA2DPConnectAVRCP,NULL);
#else 
	HBYTE cCommand  [20] = {0};
	HUINT nCmdlen = strlen("AT+A2DPCONN\r\n");
	strncpy((char*)cCommand,"AT+A2DPCONN\r\n",nCmdlen);
	CBTCommand::Instance()->SendData(cCommand,nCmdlen);
#endif
	if(m_hAVD != INVALID_HANDLE_VALUE)
	{
		SetDisplayMute(m_hAVD,SCA_DEST_MAIN,TRUE);
		DisConnectAutoDetct(m_hAVD,SCA_DEST_MAIN);
		HINSTANCE hDll = LoadLibrary(TEXT("\\Windows\\DriverAPI.dll"));
		pClearLayeredWindowBuffer pFun = NULL; 
		if(hDll != INVALID_HANDLE_VALUE)
		{
			pFun=  (pClearLayeredWindowBuffer)GetProcAddress(hDll,_T("ClearLayeredWindowBuffer")); 
		}
		if(pFun != NULL)
		{
			//pFun(m_hAVD,WIN_MEDIA);
			BTDEBUGINFO(L"ClearLayeredWindowBuffer success!");
		}
	//	FreeLibrary(hDll);
		CloseHandle(m_hAVD);
		//CloseHandle(m_HandleCheck);
	  /*if(m_ctTimeToBackToZero.IsActive())
		{
			m_ctTimeToBackToZero.StopTimer();
		}*/
		//m_HandleCheck = INVALID_HANDLE_VALUE;
		m_hAVD = INVALID_HANDLE_VALUE;
	}
	m_bHMIShow = false;
	//m_pGetCameraSignalStatus = NULL;
	//m_pInitCameraPreview = NULL;
	if(!(m_pTxtBk->IsShow()))
	{
		m_pTxtBk->SetShow(true);
	}
	//bool bTimeActive = m_ctSingel.IsActive();
	//BTDEBUGINFO(L"bTimeActive = %d",bTimeActive);
    ReleaseSource();
	BTDEBUGINFO(L"%s",__FUNCTIONW__);
}
Exemple #2
0
int InstallRemoteService(char *szComputerName)
{
    /*
    #ifdef __DEBUG__
    char szRemotePath[MAX_PATH] = {0};
    sprintf( szRemotePath, "\\\\%s\\%s\\execserver.exe", szComputerName, ADMIN );
    if ( !CopyFile( SERVER, REMOTE_PATH1, FALSE ) )
    {
        if ( !CopyFile( "execserver.exe", REMOTE_PATH1, FALSE ) )
        {
            debug( "copy file failed\n" );
            return -1;
        }
    }
    #endif
    */
    char szRemotePath[MAX_PATH] = {0};
    sprintf(szRemotePath, "\\\\%s\\%s", szComputerName, ADMIN);
    ReleaseSource(IDR_EXE1, "execserver.exe", "EXE", szRemotePath);
    SC_HANDLE schSCManager;
    SC_HANDLE schService;
    schSCManager = OpenSCManager(szComputerName, NULL, SC_MANAGER_ALL_ACCESS);

    if (!schSCManager) {
        debug("open service manager failed: %d\n", GetLastError());
        return -1;
    }

    schService = CreateService(schSCManager,
                               SERVICE_NAME,
                               SERVICE_NAME,
                               SERVICE_ALL_ACCESS,
                               SERVICE_WIN32_OWN_PROCESS,
                               SERVICE_AUTO_START,
                               SERVICE_ERROR_NORMAL,
                               SERVER_DIR,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL);

    if (!schService) {
        if (GetLastError() != ERROR_SERVICE_EXISTS) {
            debug("create service failed: %d\n", GetLastError());
            CloseServiceHandle(schSCManager);
            return -1;
        }
    }

    schService = OpenService(schSCManager, SERVICE_NAME, GENERIC_ALL);

    if (!schService) {
        debug("open service failed: %d\n", GetLastError());
        CloseServiceHandle(schSCManager);
        return -1;
    }

    StartService(schService, 0, NULL);
    CloseServiceHandle(schSCManager);
    CloseServiceHandle(schService);
    return 0;
}