How to filter the key event

Module API help / support section for programmers.

Moderators: Dreamer, FredB, X05

chattana
Just can't stay away
Posts: 43
Joined: Sun Nov 04, 2007 3:49 pm

How to filter the key event

Postby chattana » Thu Nov 08, 2007 2:27 pm

Hello all senior C++ Developers

I want my module writtent in C++ to be notified when 'I' key is pressed. How I filter the keyboard event? I know I should use this function:

int __stdcall OnDDEvent(DWORD EventType, void *EventParams)

The EventType must be DDEVENT_ON_KEYBOARD.
I am gettting stuck with *EventParams,
Should it be LWORD(*EventParams)=='I' ???

Here is the function I modified (but not working for me)

int __stdcall OnDDEvent(DWORD EventType, void *EventParams)
{
if (EventType == DDEVENT_ON_KEYBOARD)
{

if (WPARAM(EventParams)=='I')
{
MessageBox(NULL,"You Press I key",NULL,0);

}
}
return FALSE;
}

Thanks in advance.

Chattana.

Last edited by chattana on Thu Nov 08, 2007 8:54 pm, edited 1 time in total.
Twinhand 1027
XP
AMD X2 5600
Geforce 8600
chattana
Just can't stay away
Posts: 43
Joined: Sun Nov 04, 2007 3:49 pm

Postby chattana » Thu Nov 08, 2007 8:50 pm

According to this http://www.dvbdream.org/forum/viewtopic.php?t=582

Rel said that EventParams is the pointer, and we must typecast it. I do know typecast in general, but not in this case to get the correct result.

Could anybody help?
Twinhand 1027
XP
AMD X2 5600
Geforce 8600
User avatar
rel
relocation
Posts: 2051
Joined: Fri Jun 16, 2006 9:50 am

Postby rel » Fri Nov 09, 2007 2:56 am

yes, it is a pointer to an integer for DDEVENT_ON_KEYBOARD.


one of the following lines should work in C

*(int *)EventParams

*(int *)(EventParams)

*((int *)(EventParams))





if( *(int *)EventParams == 'I' )
{
MessageBox(NULL,"You Press I key",NULL,0);
}


you can fill/clear the Integer with 0 after processing (if you want DD's not to handle that keyboard key, and you will take care of it in the module)

*(int *)EventParams = 0;
DVB Dream - because I have to dream about having time to code it
chattana
Just can't stay away
Posts: 43
Joined: Sun Nov 04, 2007 3:49 pm

Postby chattana » Fri Nov 09, 2007 12:34 pm

Thanks Rel.

This works: *((int *)(EventParams))

I have other question: EventParams always return one value (to be exact, the value = 73) when I press I, i, SHIFT+I, SHIFT+i, CTRL+I, CTRL+i....

Is there anyway to recoginze the lower, and upper key, and the combination with CTRL or SHIFT?

Thanks
Twinhand 1027
XP
AMD X2 5600
Geforce 8600
User avatar
rel
relocation
Posts: 2051
Joined: Fri Jun 16, 2006 9:50 am

Postby rel » Fri Nov 09, 2007 10:54 pm

Is there anyway to recoginze the lower, and upper key, and the combination with CTRL or SHIFT?
not yet, unfortunately
DVB Dream - because I have to dream about having time to code it

Return to “Module / Plugin Programming”

Who is online

Users browsing this forum: No registered users and 1 guest