I have to create a dll/ocx that notifies the owner when a keypress occurs. This shall happen even if the ownerwindow haven't got the focus.
I've created an ocx, raising an event if a key was pressed. This works fine when i open the ocx in "ActiveX control test container" The problem is that the event doesn't fire when used from a VB/VFP program, any suggestions?
Code:
void getKey(void *data){
CKeyCapCtrl *dat1 = (CKeyCapCtrl*)data;
static int iLastKey(0);
while(dat1->running){
for(int i=1;i<256;i++){
if(GetAsyncKeyState(i) && i != iLastKey){
dat1->sendKey(i);
iLastKey = i;
break;
}
}
Sleep(100);
}
_endthread();
}