For Programmers: Free Programming Magazines  


Home > Archive > Smartphone Developer Forum > January 2005 > Hook SmartPhone action key









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Hook SmartPhone action key
news.microsoft.com

2005-01-23, 4:04 pm

Hi:
I wrote a app for hook smartphone's action key.
Hooking success,but it crash at hook callback function.

this is my code:
LRESULT CALLBACK KeyLogProc(int code, WPARAM wParam, LPARAM lParam)
{

if(code == HC_ACTION)
{
g_pKBStruct = (PKBDLLHOOKSTRUCT)lParam;
if (((PKBDLLHOOKSTRUCT)lParam)->vkCode == 0xd)//Crash at there
{
}


}
return g_pfCallNextHook(g_hHkKeyboard,code,wPar
am, lParam);
}


DQ

2005-01-23, 4:04 pm

I have had no luck with keyboard callbacks on my Audiovox 5600 either. It
seems that accessing this memory address (the keyboard structure) results in
Access Denied 1st chance exception. Your app shouldn't crash, but it won't
work.

What are you trying to capture? The Joystick Pressed In Action?

You can request a HotKey notification, though typically that won't override
other applications.

Alternately if your app is in the foreground you can use GAPI to open the
keyboard in game mode so you'll capture all keypresses. But this only works
when you're active in the foreground.

You can also subclass a window to override its keyboard messages. I've
subclasses system components for other purposes and find that it can be a
little unstable at times. But it should work for keyboard input to say the
home screen.

More than likely this will not be an easy task, but let me know if you need
help with any of these suggestions.

"news.microsoft.com" wrote:

> Hi:
> I wrote a app for hook smartphone's action key.
> Hooking success,but it crash at hook callback function.
>
> this is my code:
> LRESULT CALLBACK KeyLogProc(int code, WPARAM wParam, LPARAM lParam)
> {
>
> if(code == HC_ACTION)
> {
> g_pKBStruct = (PKBDLLHOOKSTRUCT)lParam;
> if (((PKBDLLHOOKSTRUCT)lParam)->vkCode == 0xd)//Crash at there
> {
> }
>
>
> }
> return g_pfCallNextHook(g_hHkKeyboard,code,wPar
am, lParam);
> }
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com