|
我的BSP中有个导出DLL的文件,重写了一个
advbacklight回调函数:
BOOL DllEntry( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
int GetBkLightLevel(HWND hDlg)
void SetBkLightLevel( int iData, HWND hDlg )
BOOL BacklightAdvApplet( HWND hDlg )
BOOL CALLBACK AdvancedDlgProc(HWND hwndPage, UINT message, WPARAM wParam, LPARAM lParam)
并在注册表中添加了advbacklight.dll
然后让系统在screen.cpp中调用这个DLL中的BacklightAdvApplet函数 :
if(pszFileName && (hAdvanced = LoadLibrary(pszFileName))) {
pfnAdvanced = (ADVANCEDPROC)GetProcAddress(hAdvanced, FUNCNAME_BACKLIGHTADVAPPLET);
}
其中FUNCNAME_BACKLIGHTADVAPPLET定义:
#define FUNCNAME_BACKLIGHTADVAPPLET TEXT("BacklightAdvApplet")
并在screen.cpp中这段对按下《控制面板->显示->背光灯->“高级…”》这个按键的相应处理函数
case WM_COMMAND:
switch (LOWORD(wParam))
case IDC_BADVANCED:
ASSERT(pfnAdvanced);
if(pfnAdvanced)
if( pfnAdvanced(hDlg) )
{
HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, EVENTNAME_BACKLIGHTCHANGEEVENT); if (hEvent != NULL)
{
SetEvent(hEvent);
CloseHandle(hEvent);
}
} return TRUE;
这段中创建了一个事件
其中EVENTNAME_BACKLIGHTCHANGEEVENT的定义:
//This is the event we signal when the backlight settings change.
#define EVENTNAME_BACKLIGHTCHANGEEVENT TEXT("BackLightChangeEvent")
请问:
1、这个事件HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, EVENTNAME_BACKLIGHTCHANGEEVENT); 一定是在什么地方被挂起等待被触发
应该是在哪被挂起的??这个一直没找到!
2、创建事件之后,程序就马上SetEvent(hEvent);
所以我猜想是不是在WaitForSignleObject(xxx,hEvent)
后需要ResetEvent(hEvent),而程序中没有ResetEvent,所以才导致出现
这样的打印信息:
Prefetch Abort: Thread=9e2269c4 Proc=96c292d0 'ctlpnl.exe'
AKY=00000041 PC=02b912fc RA=0321655c BVA=02b912fc FSR=000004f0 |
|