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
|
BEGIN_MESSAGE_MAP(MyPredictionBox, MyBoxPicture)
ON_WM_HSCROLL()
END_MESSAGE_MAP()
HHOOK hhk;
BOOL MyPredictionBox::OnInitDialog()
{
//initialization slider
SliderThreshold=(CSliderCtrl *)GetDlgItem(IDC_SLIDER_THRESHOLD);
SliderThreshold->SetRangeMin(40, false);
SliderThreshold->SetRangeMax(150, false);
SetDlgItemInt(IDC_EDIT_THRESHOLD, 40);
UpdateData(FALSE);
hhk = SetWindowsHookEx(WH_MSGFILTER, MsgFilterProc, 0, GetCurrentThreadId());
return TRUE;
}
void MyPredictionBox::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
}
LRESULT CALLBACK MyPredictionBox::MsgFilterProc(int nCode, WPARAM wParam, LPARAM lParam)
{
MSG *lpmsg;
lpmsg = (MSG*) lParam;
if(nCode != MSGF_DIALOGBOX) goto defRet;
if(lpmsg->message == WM_KEYDOWN) {
if(lpmsg->wParam == VK_RETURN) {
//TreatmentNewPos(); // c'est ici que j aurais besoin de getdlgitem(non static) et j ai une erreur du au fait que c est une fonction static(MsgFilterProc)
return 1;
}
}
defRet:
return (CallNextHookEx(hhk, nCode, wParam, lParam));
} |
Partager