• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetPriorityClass函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetPriorityClass函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPriorityClass函数的具体用法?C++ GetPriorityClass怎么用?C++ GetPriorityClass使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetPriorityClass函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SetPriorityClass

App::App()
{
	clan::OpenGLTarget::set_current();
	quit = false;

	// Set the window
	clan::DisplayWindowDescription desc;
	desc.set_title("ClanLib App Example");
	desc.set_size(clan::Size(1000, 700), true);
	desc.set_allow_resize(true);

	window = clan::DisplayWindow(desc);
	canvas = clan::Canvas(window);

	// Connect the Window close event
	sc.connect(window.sig_window_close(), this, &App::on_window_close);

	// Connect a keyboard handler to on_key_up()
	sc.connect(window.get_keyboard().sig_key_up(), this, &App::on_input_up);

	font = clan::Font("tahoma", 16);

	target_test_run_length_seconds = 0.5f;

	tests_run_length_microseconds = 0;
	num_iterations = 0;
	base_line = 0;

	Tests::Init(testlist);

#ifdef WIN32
	SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
	DWORD dwPriClass = GetPriorityClass(GetCurrentProcess());
	switch (dwPriClass)
	{
		case NORMAL_PRIORITY_CLASS:
			priority_class = "Process Priority: NORMAL";
			break;
		case IDLE_PRIORITY_CLASS:
			priority_class = "Process Priority: IDLE";
			break;
		case HIGH_PRIORITY_CLASS:
			priority_class = "Process Priority: HIGH";
			break;
		case REALTIME_PRIORITY_CLASS:
			priority_class = "Process Priority: REALTIME";
			break;
		case BELOW_NORMAL_PRIORITY_CLASS:
			priority_class = "Process Priority: BELOW NORMAL";
			break;
		case ABOVE_NORMAL_PRIORITY_CLASS:
			priority_class = "Process Priority: ABOVE NORMAL";
			break;
	}
	
#endif

	cb_main = clan::bind_member(this, &App::initial_pause);
	game_time.reset();
}
开发者ID:keigen-shu,项目名称:ClanLib,代码行数:60,代码来源:app.cpp


示例2: OutputDebugString

//CMD_TIMER_GUI_VIEW_EXECUTE Viewアプリ(EpgDataCap_Bon.exe)を起動
void CEpgTimerTaskDlg::CmdViewExecute(CMD_STREAM* pCmdParam, CMD_STREAM* pResParam)
{
	OutputDebugString(L"CEpgTimerTaskDlg::CmdViewExecute");
	wstring exeCmd = L"";

	ReadVALUE(&exeCmd, pCmdParam->data, pCmdParam->dataSize, NULL);

	PROCESS_INFORMATION pi;
	STARTUPINFO si;
	ZeroMemory(&si,sizeof(si));
	si.cb=sizeof(si);
	if( exeCmd.find(L".bat") != string::npos ){
		si.wShowWindow |= SW_SHOWMINNOACTIVE;
		si.dwFlags |= STARTF_USESHOWWINDOW;
	}

	BOOL bRet = CreateProcess( NULL, (WCHAR*)exeCmd.c_str(), NULL, NULL, FALSE, GetPriorityClass(GetCurrentProcess()), NULL, NULL, &si, &pi );
	CloseHandle(pi.hThread);
	CloseHandle(pi.hProcess);

	if( bRet == TRUE ){
		pResParam->dataSize = GetVALUESize(pi.dwProcessId);
		pResParam->data = new BYTE[pResParam->dataSize];
		WriteVALUE(pi.dwProcessId, pResParam->data, pResParam->dataSize, NULL);
		pResParam->param = CMD_SUCCESS;
	}else{
		pResParam->param = CMD_ERR;
	}
}
开发者ID:ACUVE,项目名称:EDCB,代码行数:30,代码来源:EpgTimerTaskDlg.cpp


示例3: GetProcessList

void GetProcessList()
{
	PROCESSENTRY32 pe32;
	HANDLE hSnapshot;
	HANDLE hProcess;
	DWORD dwPriorityClass;
	
	hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
	pe32.dwSize = sizeof(PROCESSENTRY32);

	Process32First( hSnapshot, &pe32 );

	SendMessage(hListBox1, LB_RESETCONTENT, 0, 0);

	do {
		dwPriorityClass = 0;
		hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
		dwPriorityClass = GetPriorityClass(hProcess);

		char text[1024];
		swprintf((wchar_t*)text, L"[%d] %s [%s]", pe32.th32ProcessID, pe32.szExeFile, GetPriorityClassName(dwPriorityClass));
		int index = SendMessage(hListBox1, LB_ADDSTRING, 0, (LPARAM)text);
		SendMessage(hListBox1, LB_SETITEMDATA, index, (LPARAM)pe32.th32ProcessID);

	} while (Process32Next(hSnapshot, &pe32));

	CloseHandle(hSnapshot);	
}
开发者ID:nancy-bree,项目名称:_bsuir,代码行数:28,代码来源:Lab5.cpp


示例4: OpenProcess

void CREBUS::changeBuildPriority(_bstr_t project_id, int direction)
{
	ProjectTypeLib::Automation2Ptr project = 
		rebus.getProject(atol((char *) project_id));
	
	_bstr_t process_id = project->Getprocess_id();

	HANDLE hProcess = OpenProcess(PROCESS_SET_INFORMATION | PROCESS_QUERY_INFORMATION, 
		FALSE, atol(process_id));

	if(hProcess)
	{
		const int iClasses = 4;
		DWORD dwPriorities[iClasses] = { IDLE_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, 
										 NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS};

		DWORD dwPriorityClass = GetPriorityClass(hProcess);

		for(int i = 0; i < iClasses; i++) {
			if(dwPriorities[i] == dwPriorityClass) {
				if(i + direction >=0 && i + direction < iClasses)
				{
					dwPriorityClass = dwPriorities[i + direction];
					break;
				}
			}
		}

		SetPriorityClass(hProcess, dwPriorityClass);
		CloseHandle(hProcess);
	}
}
开发者ID:vactorwu,项目名称:pbrebus,代码行数:32,代码来源:REBUS.cpp


示例5: GetPriorityClass

/** 
 * 
 * Returns priority of process
 * 
 * @param       csPriority_o - Process priority as string.
 * @return      bool         - Returns execution status.
 * @exception   Nil
 * @see         Nil
 * @since       1.0
 */
bool Process::ExtractProcessPriority( CString& csPriority_o ) const
{
    const DWORD dwPriorityClass = GetPriorityClass( m_ahmProcess );
    switch( dwPriorityClass )
    {
        case NORMAL_PRIORITY_CLASS:
            csPriority_o = _T( "Priority: Normal" );
            break;
        case ABOVE_NORMAL_PRIORITY_CLASS:
            csPriority_o = _T( "Priority: Above normal" );
            break;
        case BELOW_NORMAL_PRIORITY_CLASS:
            csPriority_o = _T( "Priority: Below normal" );
            break;
        case HIGH_PRIORITY_CLASS:
            csPriority_o = _T( "Priority: High" );
            break;
        case REALTIME_PRIORITY_CLASS:
            csPriority_o = _T( "Priority: Realtime" );
            break;
        case IDLE_PRIORITY_CLASS:
            csPriority_o = _T( "Priority: Idle" );
            break;
        default:
            return false;
    }// End switch

    return true;
}// End GetProcessPriority
开发者ID:caidongyun,项目名称:libs,代码行数:39,代码来源:Process.cpp


示例6: ShowMenuProcessPriority

void ShowMenuProcessPriority(HWND hWnd, DWORD processID)
{
	HANDLE hProcess;
	HMENU hPopupMenu;

	hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, processID);
	if (hProcess == NULL || hWnd == NULL) return;

	saveProcessID = processID;

	DWORD priority = GetPriorityClass(hProcess);
	hPopupMenu = CreatePopupMenu();

	UINT flags;
	for (int i = 0; i < 6; i++)
	{
		flags = MF_BYPOSITION | MF_STRING | (priority == priorityArray[i] ? MF_CHECKED : MF_ENABLED);
		AppendMenu(hPopupMenu, flags, priorityArray[i], szPriorityName[i]);
	}
	SetForegroundWindow(hWnd);

	POINT point;
	GetCursorPos(&point);

	TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, 0, hWnd, NULL);
	DestroyMenu(hPopupMenu);
	CloseHandle(hProcess);
}
开发者ID:EdwOK,项目名称:SP_Fifth_Semester,代码行数:28,代码来源:Paprotski.Lab8.cpp


示例7: dim_get_scheduler_class

int dim_get_scheduler_class(int *pclass)
{
	HANDLE hProc;
	DWORD ret;

#ifndef PXI
	hProc = GetCurrentProcess();

	ret = GetPriorityClass(hProc);
	if(ret == 0)
	  return 0;
	if(ret == IDLE_PRIORITY_CLASS)
		*pclass = -1;
/*
	else if(ret == BELOW_NORMAL_PRIORITY_CLASS)
		*pclass = -1;
*/
	else if(ret == NORMAL_PRIORITY_CLASS)
		*pclass = 0;
/*
	else if(ret == ABOVE_NORMAL_PRIORITY_CLASS)
		*pclass = 1;
*/
	else if(ret == HIGH_PRIORITY_CLASS)
		*pclass = 1;
	else if(ret == REALTIME_PRIORITY_CLASS)
		*pclass = 2;
	return 1;
#else
	*pclass = 0;
	return 0;
#endif
}
开发者ID:larks,项目名称:DIM-FreeRTOS,代码行数:33,代码来源:dim_thr.c


示例8: ListProcess

DWORD ListProcess()
{
	PROCESSENTRY32 p;
	HANDLE hProcessSnap;
	HANDLE hProcess;
	DWORD dwPriorityClass;
	p.dwSize = sizeof(PROCESSENTRY32);
	hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
	
	if (!Process32First(hProcessSnap, &p))
		return (-1);
	do{
		hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, p.th32ProcessID);
		dwPriorityClass = GetPriorityClass(hProcess);

		_tprintf(TEXT("#### PROCESS %s ####\n"), p.szExeFile);
		printf("\tProcess ID             : %d\n",p.th32ProcessID);
		printf("\tProcess THREAD COUNT   : %d\n", p.cntThreads);
		printf("\tProcess USAGE          : %d\n", p.cntUsage);
		printf("\tProcess PRIORITY BASE  : %d\n", p.pcPriClassBase);
		if (dwPriorityClass)
			printf("\tProcess PRIORITY CLASS : %d\n", dwPriorityClass);
		printf("\n\n");
	} while (Process32Next(hProcessSnap, &p));
	return (1);
}
开发者ID:SakiiR,项目名称:SakiirProcView,代码行数:26,代码来源:ProcFuncs.cpp


示例9: set_background_priority

void set_background_priority(int status) {
	DWORD dwError, dwPriClass;

	dwPriClass = GetPriorityClass(GetCurrentProcess());
	_tprintf(TEXT("Current priority class is 0x%x\n"), dwPriClass);

	if (!SetPriorityClass(GetCurrentProcess(), status)) {
		dwError = GetLastError();
		_tprintf(TEXT("Failed to enter background mode (%d)\n"), dwError);
	} else {
		_tprintf(TEXT("succeed to set priority.\n"));
	}
	// Display priority class
	dwPriClass = GetPriorityClass(GetCurrentProcess());
	_tprintf(TEXT("Current priority class is 0x%x\n"), dwPriClass);
}
开发者ID:jlguenego,项目名称:sandbox,代码行数:16,代码来源:main.c


示例10: hythread_get_os_priority

/**
 * Return the OS's scheduling policy and priority for a thread.
 *
 * Query the OS to determine the actual priority of the specified thread.
 * The priority and scheduling policy are stored in the pointers provided.
 * On Windows the "policy" contains the thread's priority class.
 * On POSIX systems it contains the scheduling policy
 * On OS/2 no information is available.  0 is stored in both pointers.
 *
 * @param[in] thread a thread
 * @param[in] policy pointer to location where policy will be stored (non-NULL)
 * @param[in] priority pointer to location where priority will be stored (non-NULL)
 * @return 0 on success or negative value on failure
 */
IDATA VMCALL
hythread_get_os_priority (hythread_t thread, IDATA * policy, IDATA * priority)
{
#if defined(HY_POSIX_THREADS)
  struct sched_param sched_param;
  int osPolicy, rc;
  rc = pthread_getschedparam (thread->handle, &osPolicy, &sched_param);
  if (rc)
    return -1;
  *priority = sched_param.sched_priority;
  *policy = osPolicy;
#else
#if defined(WIN32)
  *priority = GetThreadPriority (thread->handle);
  if (*priority == THREAD_PRIORITY_ERROR_RETURN)
    return -1;

  *policy = GetPriorityClass (thread->handle);
  if (*policy == 0)
    return -1;
#else

#error Unknown platform

#endif /* HY_POSIX_THREADS */
#endif /* HYEPOC32 */

  return 0;
}
开发者ID:freeVM,项目名称:freeVM,代码行数:43,代码来源:thrprof.c


示例11: getpriority

int getpriority(int which, int who)
{
	unsigned int priorityClass;

	ADM_assert(which == PRIO_PROCESS);
	ADM_assert(who == 0);

	priorityClass = GetPriorityClass(GetCurrentProcess());

	switch (priorityClass)
	{
		case HIGH_PRIORITY_CLASS:
			return -18;
			break;
		case ABOVE_NORMAL_PRIORITY_CLASS:
			return -10;
			break;
		case NORMAL_PRIORITY_CLASS:
			return 0;
			break;
		case BELOW_NORMAL_PRIORITY_CLASS:
			return 10;
			break;
		case IDLE_PRIORITY_CLASS:
			return 18;
			break;
		default:
			ADM_assert(0);
	}
}
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:30,代码来源:ADM_win32.cpp


示例12: GetProcessList

bool GetProcessList()
{
    HANDLE hProcessSnap;
    HANDLE hProcess;
    PROCESSENTRY32 pe32;
    DWORD dwPriorityClass;

    // Take a snapshot of all processes in the system.
    hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
    if( hProcessSnap == INVALID_HANDLE_VALUE )
    {
        fprintf( stderr, "Error: CreateToolhelp32Snapshot (of processes)\n");
        return false;
    }

    // Set the size of the structure before using it.
    pe32.dwSize = sizeof( PROCESSENTRY32 );

    // Retrieve information about the first process,
    // and exit if unsuccessful
    if( !Process32First( hProcessSnap, &pe32 ) )
    {
        fprintf( stderr, "Error: Process32First\n"); // show cause of failure
        CloseHandle( hProcessSnap );          // clean the snapshot object
        return false;
    }

    // Now walk the snapshot of processes, and
    // display information about each process in turn
    do
    {
        fprintf( stderr, "\n=====================================================\n" );
        fwprintf( stderr, L"PROCESS NAME:  %ls\n", pe32.szExeFile );
        fprintf( stderr, "-------------------------------------------------------\n" );

        // Retrieve the priority class.
        dwPriorityClass = 0;
        hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID );
        if( hProcess == NULL )
            fprintf( stderr, "Error: OpenProcess");
        else
        {
            dwPriorityClass = GetPriorityClass( hProcess );
            if( !dwPriorityClass )
                fprintf( stderr, "GetPriorityClass");
            CloseHandle( hProcess );
        }

        fprintf( stderr, "  Process ID        = 0x%08lX\n", pe32.th32ProcessID );
        fprintf( stderr, "  Thread count      = %lu\n",   pe32.cntThreads );
        fprintf( stderr, "  Parent process ID = 0x%08lX\n", pe32.th32ParentProcessID );
        fprintf( stderr, "  Priority base     = %lu\n", pe32.pcPriClassBase );
        if( dwPriorityClass )
            fprintf( stderr, "  Priority class    = %lu\n", dwPriorityClass );

    } while( Process32Next( hProcessSnap, &pe32 ) );

    CloseHandle( hProcessSnap );
    return true;
}
开发者ID:hfenigma,项目名称:D3MH,代码行数:60,代码来源:helper.cpp


示例13: rtsyn_synth_start

int rtsyn_synth_start(){
	int i;
	UINT port;

#ifdef __W32__
	DWORD processPriority;
	processPriority = GetPriorityClass(GetCurrentProcess());
#endif

	
	port=0;
	sleep(2);
	for(port=0;port<rtsyn_portnumber;port++){
		for (i=0;i<MAX_EXBUF;i++){
			IMidiHdr[port][i] = (MIDIHDR *)sIMidiHdr[port][i];
			memset(IMidiHdr[port][i],0,sizeof(MIDIHDR));
			IMidiHdr[port][i]->lpData = sImidiHdr_data[port][i];
			memset((IMidiHdr[port][i]->lpData),0,BUFF_SIZE);
			IMidiHdr[port][i]->dwBufferLength = BUFF_SIZE;
		}
	}
	evbwpoint=0;
	evbrpoint=0;
	mvbuse=0;

	for(port=0;port<rtsyn_portnumber;port++){
		midiInOpen(&hMidiIn[port],portID[port],(DWORD)MidiInProc,(DWORD)port,CALLBACK_FUNCTION);
		for (i=0;i<MAX_EXBUF;i++){
			midiInUnprepareHeader(hMidiIn[port],IMidiHdr[port][i],sizeof(MIDIHDR));
			midiInPrepareHeader(hMidiIn[port],IMidiHdr[port][i],sizeof(MIDIHDR));
			midiInAddBuffer(hMidiIn[port],IMidiHdr[port][i],sizeof(MIDIHDR));
		}
	}

#ifdef __W32__
	// HACK:midiInOpen()でリセットされてしまうため、再設定
	SetPriorityClass(GetCurrentProcess(), processPriority);
#endif
	for(port=0;port<rtsyn_portnumber;port++){
		if(MMSYSERR_NOERROR !=midiInStart(hMidiIn[port])){
			int i;
			for(i=0;i<port;i++){
				midiInStop(hMidiIn[i]);
				midiInReset(hMidiIn[i]);
				midiInClose(hMidiIn[i]);
			}
			goto winmmerror;
		}
	}
	mim_start_time = get_current_calender_time();
	InitializeCriticalSection(&mim_section);
	return ~0;

winmmerror:
	ctl->cmsg(  CMSG_ERROR, VERB_NORMAL, "midiInStarterror\n" );
	return 0;
}
开发者ID:Distrotech,项目名称:TiMidity,代码行数:57,代码来源:rtsyn_winmm.c


示例14: gpgex_spawn_detached

/* Fork and exec the program with /dev/null as stdin, stdout and
   stderr.  Returns 0 on success or an error code.  */
gpg_error_t
gpgex_spawn_detached (const char *cmdline)
{
    SECURITY_ATTRIBUTES sec_attr;
    PROCESS_INFORMATION pi =
    {
        NULL,      /* Returns process handle.  */
        0,         /* Returns primary thread handle.  */
        0,         /* Returns pid.  */
        0          /* Returns tid.  */
    };
    STARTUPINFO si;
    int cr_flags;

    TRACE_BEG1 (DEBUG_ASSUAN, "gpgex_spawn_detached", cmdline,
                "cmdline=%s", cmdline);

    /* Prepare security attributes.  */
    memset (&sec_attr, 0, sizeof sec_attr);
    sec_attr.nLength = sizeof sec_attr;
    sec_attr.bInheritHandle = FALSE;

    /* Start the process.  Note that we can't run the PREEXEC function
       because this would change our own environment. */
    memset (&si, 0, sizeof si);
    si.cb = sizeof (si);
    si.dwFlags = STARTF_USESHOWWINDOW;
    si.wShowWindow = DEBUG_W32_SPAWN ? SW_SHOW : SW_MINIMIZE;

    cr_flags = (CREATE_DEFAULT_ERROR_MODE
                | GetPriorityClass (GetCurrentProcess ())
                | CREATE_NEW_PROCESS_GROUP
                | DETACHED_PROCESS);

    if (!CreateProcess (NULL,          /* pgmname; Program to start.  */
                        (char *) cmdline, /* Command line arguments.  */
                        &sec_attr,     /* Process security attributes.  */
                        &sec_attr,     /* Thread security attributes.  */
                        TRUE,          /* Inherit handles.  */
                        cr_flags,      /* Creation flags.  */
                        NULL,          /* Environment.  */
                        NULL,          /* Use current drive/directory.  */
                        &si,           /* Startup information. */
                        &pi            /* Returns process information.  */
                       ))
    {
        (void) TRACE_LOG1 ("CreateProcess failed: %i\n", GetLastError ());
        return gpg_error (GPG_ERR_GENERAL);
    }

    /* Process has been created suspended; resume it now. */
    CloseHandle (pi.hThread);
    CloseHandle (pi.hProcess);

    return 0;
}
开发者ID:gpg,项目名称:gpgex,代码行数:58,代码来源:exechelp.c


示例15: LptDrvOpen

UINT _APICALL LptDrvOpen(UINT LptNum, DWORD lParam2) {
    if (LptNum >= PortCount) return FALSE;
    PortCurrent = LptNum;
    /* Try to set process priority */
    oldpriority = GetPriorityClass(GetCurrentProcess());
    if (!SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS)) {
        oldpriority = 0;
    }
    return TRUE;
}
开发者ID:dmitrystu,项目名称:LptDrv,代码行数:10,代码来源:main.c


示例16: setpriority

int setpriority(
		int which,
		int who,
		int prio
		)
{
	BOOL success;
	DWORD prio_class;

	if (PRIO_PROCESS != which || who || NTP_PRIO != prio) {
		DPRINTF(1,("windows setpriority() clone needs work.\n"));
	}

	prio_class = GetPriorityClass(GetCurrentProcess());
	
	if (HIGH_PRIORITY_CLASS == prio_class ||
	    REALTIME_PRIORITY_CLASS == prio_class)
		return 0;

	success = SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);

	if (!success) {
		msyslog(LOG_ERR, "Unable to raise priority: %m"); 
		errno = EPERM;
		return -1;
	}

	prio_class = GetPriorityClass(GetCurrentProcess());

	if (REALTIME_PRIORITY_CLASS == prio_class)
		msyslog(LOG_INFO, "Raised to realtime priority class");
	else if (HIGH_PRIORITY_CLASS == prio_class)
		msyslog(LOG_ERR,  "Raised to high priority class, realtime "
				  "requires Increase Scheduling Priority "
				  "privilege (enabled with secpol.msc).");
	else
		msyslog(LOG_ERR,  "Unexpected process priority class %d",
				 prio_class);

	return 0; 
}
开发者ID:Distrotech,项目名称:ntp,代码行数:41,代码来源:setpriority.c


示例17: CreateToolhelp32Snapshot

ProcessList QtProcessFinder::search() {
	ProcessList list;

	HANDLE hProcessSnap;
	HANDLE hProcess;
	PROCESSENTRY32 pe32;
	DWORD dwPriorityClass;

	// Take a snapshot of all processes in the system.
	hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
	if (hProcessSnap == INVALID_HANDLE_VALUE) {
		qFatal("CreateToolhelp32Snapshot (of processes)");
		return list;
	}

	// Set the size of the structure before using it.
	pe32.dwSize = sizeof(PROCESSENTRY32);

	// Retrieve information about the first process,
	// and exit if unsuccessful
	if (!Process32First(hProcessSnap, &pe32)) {
		qFatal("Process32First");  // show cause of failure
		CloseHandle(hProcessSnap); // clean the snapshot object
		return list;
	}

	// Now walk the snapshot of processes, and
	// display information about each process in turn
	do {
		// Skip the system idle process
		if (pe32.th32ProcessID == 0) continue;

		// Retrieve the priority class.
		dwPriorityClass = 0;
		hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
		if (hProcess == NULL)
			qDebug("OpenProcess");
		else {
			dwPriorityClass = GetPriorityClass(hProcess);
			if (!dwPriorityClass) qDebug("GetPriorityClass");
			CloseHandle(hProcess);
		}

		// List the modules and threads associated with this process
		if (processUsesQt(pe32.th32ProcessID)) {
			list.push_back(Process(pe32.th32ProcessID, QString::fromStdWString(pe32.szExeFile)));
		}

	} while (Process32Next(hProcessSnap, &pe32));

	CloseHandle(hProcessSnap);
	return list;
}
开发者ID:othrayte,项目名称:qtinterfaceinspector,代码行数:53,代码来源:qtprocessfinder.cpp


示例18: State2Priority

void CServerApp::SetPriority( int nStateFlags )
{
#ifdef _WIN32
    int dwPriorityClass = State2Priority( nStateFlags );
    list<HANDLE>::iterator iter = m_lstProcHandles.begin();
    while( iter!=m_lstProcHandles.end() ) {
        HANDLE hProc = *iter++;
        if( GetPriorityClass(hProc)!=dwPriorityClass ) {
            SetPriorityClass( hProc, dwPriorityClass );
        }
    }
#endif
}
开发者ID:EISALab,项目名称:MIIGAgroundwater,代码行数:13,代码来源:ncpsession.cpp


示例19: CAMLparam5

CAMLprim value w_create_process_native
(value prog, value wprog, value wargs, value fd1, value fd2, value fd3)
{
  int res, flags;
  PROCESS_INFORMATION pi;
  STARTUPINFOW si;
  wchar_t fullname [MAX_PATH];
  HANDLE h;
  CAMLparam5(wprog, wargs, fd1, fd2, fd3);

  res = SearchPathW (NULL, (LPCWSTR) String_val(wprog), L".exe",
		     MAX_PATH, fullname, NULL);
  if (res == 0) {
    win32_maperr (GetLastError ());
    uerror("create_process", prog);
  }

  ZeroMemory(&si, sizeof(STARTUPINFO));

  si.cb = sizeof(STARTUPINFO);
  si.dwFlags = STARTF_USESTDHANDLES;
  si.hStdInput = Handle_val(fd1);
  si.hStdOutput = Handle_val(fd2);
  si.hStdError = Handle_val(fd3);

  flags = GetPriorityClass (GetCurrentProcess ());
  /*
  h = CreateFile ("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
                  OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  if (h != INVALID_HANDLE_VALUE)
    CloseHandle (h);
  else {
    flags |= CREATE_NEW_CONSOLE;
    //    si.dwFlags |= STARTF_USESHOWWINDOW;
    //    si.wShowWindow = SW_MINIMIZE;
  }
  */

  res = CreateProcessW (fullname, (LPWSTR) String_val(wargs),
			NULL, NULL, TRUE, flags,
		        NULL, NULL, &si, &pi);
  if (res == 0) {
    win32_maperr (GetLastError ());
    uerror("create_process", prog);
  }

  CloseHandle (pi.hThread);
  CAMLreturn (Val_long (pi.hProcess));
}
开发者ID:Phylliade,项目名称:Unison,代码行数:49,代码来源:system_win_stubs.c


示例20: GetPriorityClass

ProcessPriority HProcess::GetPriority() const
{
    DWord dwWinPriority = GetPriorityClass( m_hThreadingObject );
    DebugAssert( dwWinPriority != 0 );

    switch( dwWinPriority ) {
        case IDLE_PRIORITY_CLASS:         return PROCESS_PRIORITY_IDLETIME;
        case BELOW_NORMAL_PRIORITY_CLASS: return PROCESS_PRIORITY_LOW;
        case NORMAL_PRIORITY_CLASS:       return PROCESS_PRIORITY_DEFAULT;
        case ABOVE_NORMAL_PRIORITY_CLASS: return PROCESS_PRIORITY_HIGH;
        case HIGH_PRIORITY_CLASS:         return PROCESS_PRIORITY_VERYHIGH;
        case REALTIME_PRIORITY_CLASS:     return PROCESS_PRIORITY_REALTIME;
        default: DebugAssert( false ); return PROCESS_PRIORITY_DEFAULT;
    }
}
开发者ID:Shikifuyin,项目名称:Scarab-Engine,代码行数:15,代码来源:Threading.cpp



注:本文中的GetPriorityClass函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetPrivateProfileInt函数代码示例发布时间:2022-05-30
下一篇:
C++ GetPrim函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap