mrDarker
2025-08-16 5e802e47375cb399b91f0abdc95420d6cce0b18b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "StdAfx.h"
#include "PriorityThread.h"
 
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
 
CPriorityThread::CPriorityThread(IPriorityThread2Parent* pFT2P, int nPriority) : CWorkThreadPool(1), m_pPT2P(pFT2P)
{
    m_nPriority = nPriority;
}
 
CPriorityThread::~CPriorityThread(void)
{
 
}
 
void CPriorityThread::WorkThreadProcess(PVOID pParameter)
{
    if (m_pPT2P==NULL) return;
 
    CPriorityThreadData *pData = static_cast<CPriorityThreadData*>(pParameter);
    if (pData==NULL) return;
 
    HANDLE hThread = GetCurrentThread();
    SetThreadPriority(hThread, m_nPriority);
 
    m_pPT2P->IPT2P_PriorityThread(pData);    
}
 
BOOL CPriorityThread::AddPriorityThreadData(UINT msg, WPARAM wParam, LPARAM lParam)
{
    CPriorityThreadData *pData = new CPriorityThreadData(this);
    if (pData==NULL) return FALSE;
 
    pData->m_unMsg = msg;
    pData->m_WParam = wParam;
    pData->m_LParam = lParam;
 
    return CreateWorkThread(pData);
}