Derivation of the priority value in the window - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Derivation of the priority value in the window

How can I withdraw the priority value in the window at me, he always brings to 32 for the process, and 0 for the flow of what went wrong?

TCHAR CommandLine[256] = _T("notepad ReadMe.txt");
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static STARTUPINFO tin;
static PROCESS_INFORMATION pInfo;
static DWORD exitCode;
PAINTSTRUCT ps;
HDC hdc;
TCHAR str[60], tmp[20];
int i, sum;
static LARGE_INTEGER frequency, Start, End;
static __int64 totalTime;
static DWORD thinf;
switch (message)
{
case WM_CREATE:
tin.cb = sizeof(STARTUPINFO);
tin.dwFlags = STARTF_USESHOWWINDOW;
tin.wShowWindow=SW_SHOWMINIMIZED;

break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case ID_FILE_OPEN:
GetExitCodeProcess(pInfo.hProcess, &exitCode);
if (exitCode != STILL_ACTIVE)
{
CreateProcess(NULL, CommandLine,
NULL, NULL, FALSE, 0, NULL, NULL, &tin, &pInfo);
SetPriorityClass(GetCurrentThread(),HIGH_PRIORITY_CLASS);
// SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_ABOVE_NORMAL);
//thinf=GetThreadPriority(GetCurrentThread());

thinf=GetPriorityClass(GetCurrentProcess());
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&Start);

}
break;
case ID_FILE_DELETE:
GetExitCodeProcess(pInfo.hProcess, &exitCode);
if (exitCode==STILL_ACTIVE)
{
TerminateProcess(pInfo.hProcess, 0);
QueryPerformanceCounter(&End);
totalTime = (End.QuadPart - Start.QuadPart)*1000/
frequency.QuadPart;
InvalidateRect(hWnd, NULL, TRUE);
}
break;
case IDM_EXIT: DestroyWindow(hWnd); break;
default: return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
_tcscpy(str, _T("????? ?????? ????? ? ??: "));
_i64tot(totalTime, tmp, 10);
_tcscat(str, tmp);
TextOut(hdc, 0, 0, str, _tcslen(str));

_i64tot(thinf, str, 10);
TextOut(hdc, 0, 20, str, _tcslen(str));
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default: return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
Sign In or Register to comment.