From: werD on
Im running into a problem with a locking app im working on. Im using
UnregisterFunc1 along with RegisterHotkey from coredll.dll to disable
softkeys and phone buttons and such. my problem is that when i use them to
lock and then unlock ie close app the buttons still no longer work until the
device goes through a soft reset. Is there a way that I can get the handle
off the apps needed and set them back to their original hotkeys or a function
to set them back to what they were last laoded as, or is there some other way
to achieve the lock/unlock abilities beyond these? For the hardware keys im
using SHSetAppKeyWndAssoc from aygshell.dll which give the expected results
but im stil unable to stop the windows key from makig it where a user might
accidentally press something in there pocket.

here's where i disable the soft key. Does anyone know how i can "undo" this?

Public Enum KeyModifiers
None = 0
Alt = 1
Control = 2
Shift = 4
Windows = 8
End Enum


Public Enum vKeys As Byte
'Hardware Keys 1-6
HardwareKey1 = 193
HardwareKey2 = 194
HardwareKey3 = 195
HardwareKey4 = 196
HardwareKey5 = 197
hardwarekey6 = 198

'SoftKeys L/R
SoftKeyLeft = 112
SoftKeyRight = 113

'Phone G/R
PhoneOpen = 114
PhoneClose = 115

End Enum
<DllImport("coredll.dll", SetLastError:=True)> _
Public Shared Function RegisterHotKey(ByVal Handle As IntPtr, ByVal
id As Integer, ByVal Modifiers As UInteger, ByVal key As UInteger) As Boolean

End Function
<DllImport("coredll.dll")> _
Public Shared Function UnregisterFunc1(ByVal modifiers As KeyModifiers,
ByVal keyID As Integer) As Boolean
End Function


UnregisterFunc1(KeyModifiers.None, vKeys.SoftKeyLeft)

'I dont think this is running bcause a press of the no unregistered Softkey
does noting even after the app quits
RegisterHotKey(Me.Handle, 0, KeyModifiers.None, vKeys.SoftKeyLeft)




Id appreciate any insight or experience on this one?


Thanks

DrewG

From: werD on
Ive been looking into different ways of reinstating the functionality and
thought that perhaps i would need to stop the process "cprog.exe" but i
downloaded a task manager hoping to find that the handle or process id was
persistant and went to close the process as a test and immediately lost
phone service!(that would suck if I got a call and went to unlock and answer
but dropped instead)
So it looks like the only way I can do this is to get RegisterHotKey to
work properly

for that I at least need to know how to dynamically get the handle for
cprog.exe

Can anyone suggest a direction to go in to get this acomplished or let me
know why my buttons lose all functionality(ie registerhotkey isnt registering
or perhaps needs to be flushed?) should i perhaps look into replacing the
phone launch program with a launcher through a registry edit that would call
the app or hang up(that is if i can get registerhotkey working like it
supposed to)? i dont think this would be as easily manageable across devices
though its not at all ruled out at the moment.




Linkage
A Nice Free task manager from a guy who goes by
DotFred(http://buzzdev.net/index.php?option=com_phorum&Itemid=125&phorum_query=read,27,15027,page=1)



"werD" wrote:

> Im running into a problem with a locking app im working on. Im using
> UnregisterFunc1 along with RegisterHotkey from coredll.dll to disable
> softkeys and phone buttons and such. my problem is that when i use them to
> lock and then unlock ie close app the buttons still no longer work until the
> device goes through a soft reset. Is there a way that I can get the handle
> off the apps needed and set them back to their original hotkeys or a function
> to set them back to what they were last laoded as, or is there some other way
> to achieve the lock/unlock abilities beyond these? For the hardware keys im
> using SHSetAppKeyWndAssoc from aygshell.dll which give the expected results
> but im stil unable to stop the windows key from makig it where a user might
> accidentally press something in there pocket.
>
> here's where i disable the soft key. Does anyone know how i can "undo" this?
>
> Public Enum KeyModifiers
> None = 0
> Alt = 1
> Control = 2
> Shift = 4
> Windows = 8
> End Enum
>
>
> Public Enum vKeys As Byte
> 'Hardware Keys 1-6
> HardwareKey1 = 193
> HardwareKey2 = 194
> HardwareKey3 = 195
> HardwareKey4 = 196
> HardwareKey5 = 197
> hardwarekey6 = 198
>
> 'SoftKeys L/R
> SoftKeyLeft = 112
> SoftKeyRight = 113
>
> 'Phone G/R
> PhoneOpen = 114
> PhoneClose = 115
>
> End Enum
> <DllImport("coredll.dll", SetLastError:=True)> _
> Public Shared Function RegisterHotKey(ByVal Handle As IntPtr, ByVal
> id As Integer, ByVal Modifiers As UInteger, ByVal key As UInteger) As Boolean
>
> End Function
> <DllImport("coredll.dll")> _
> Public Shared Function UnregisterFunc1(ByVal modifiers As KeyModifiers,
> ByVal keyID As Integer) As Boolean
> End Function
>
>
> UnregisterFunc1(KeyModifiers.None, vKeys.SoftKeyLeft)
>
> 'I dont think this is running bcause a press of the no unregistered Softkey
> does noting even after the app quits
> RegisterHotKey(Me.Handle, 0, KeyModifiers.None, vKeys.SoftKeyLeft)
>
>
>
>
> Id appreciate any insight or experience on this one?
>
>
> Thanks
>
> DrewG
>
From: Henryk Birecki on
Does it happen on all devices or a specific one? I have not really had
any troubles with hardware keys using the (Un)RegisterHotkey or
SHSetKeyAssoc (not sure exactly at the moment if this is the correct
name) set of API except for hx2100 series of iPaqs on which keys seem
to freeze.

Henryk Birecki

werD <werD(a)discussions.microsoft.com> wrote:

>Ive been looking into different ways of reinstating the functionality and
>thought that perhaps i would need to stop the process "cprog.exe" but i
>downloaded a task manager hoping to find that the handle or process id was
>persistant and went to close the process as a test and immediately lost
>phone service!(that would suck if I got a call and went to unlock and answer
>but dropped instead)
> So it looks like the only way I can do this is to get RegisterHotKey to
>work properly
>
>for that I at least need to know how to dynamically get the handle for
>cprog.exe
>
>Can anyone suggest a direction to go in to get this acomplished or let me
>know why my buttons lose all functionality(ie registerhotkey isnt registering
>or perhaps needs to be flushed?) should i perhaps look into replacing the
>phone launch program with a launcher through a registry edit that would call
>the app or hang up(that is if i can get registerhotkey working like it
>supposed to)? i dont think this would be as easily manageable across devices
>though its not at all ruled out at the moment.
>
>
>
>
>Linkage
>A Nice Free task manager from a guy who goes by
>DotFred(http://buzzdev.net/index.php?option=com_phorum&Itemid=125&phorum_query=read,27,15027,page=1)
>
>
>
>"werD" wrote:
>
>> Im running into a problem with a locking app im working on. Im using
>> UnregisterFunc1 along with RegisterHotkey from coredll.dll to disable
>> softkeys and phone buttons and such. my problem is that when i use them to
>> lock and then unlock ie close app the buttons still no longer work until the
>> device goes through a soft reset. Is there a way that I can get the handle
>> off the apps needed and set them back to their original hotkeys or a function
>> to set them back to what they were last laoded as, or is there some other way
>> to achieve the lock/unlock abilities beyond these? For the hardware keys im
>> using SHSetAppKeyWndAssoc from aygshell.dll which give the expected results
>> but im stil unable to stop the windows key from makig it where a user might
>> accidentally press something in there pocket.
>>
>> here's where i disable the soft key. Does anyone know how i can "undo" this?
>>
>> Public Enum KeyModifiers
>> None = 0
>> Alt = 1
>> Control = 2
>> Shift = 4
>> Windows = 8
>> End Enum
>>
>>
>> Public Enum vKeys As Byte
>> 'Hardware Keys 1-6
>> HardwareKey1 = 193
>> HardwareKey2 = 194
>> HardwareKey3 = 195
>> HardwareKey4 = 196
>> HardwareKey5 = 197
>> hardwarekey6 = 198
>>
>> 'SoftKeys L/R
>> SoftKeyLeft = 112
>> SoftKeyRight = 113
>>
>> 'Phone G/R
>> PhoneOpen = 114
>> PhoneClose = 115
>>
>> End Enum
>> <DllImport("coredll.dll", SetLastError:=True)> _
>> Public Shared Function RegisterHotKey(ByVal Handle As IntPtr, ByVal
>> id As Integer, ByVal Modifiers As UInteger, ByVal key As UInteger) As Boolean
>>
>> End Function
>> <DllImport("coredll.dll")> _
>> Public Shared Function UnregisterFunc1(ByVal modifiers As KeyModifiers,
>> ByVal keyID As Integer) As Boolean
>> End Function
>>
>>
>> UnregisterFunc1(KeyModifiers.None, vKeys.SoftKeyLeft)
>>
>> 'I dont think this is running bcause a press of the no unregistered Softkey
>> does noting even after the app quits
>> RegisterHotKey(Me.Handle, 0, KeyModifiers.None, vKeys.SoftKeyLeft)
>>
>>
>>
>>
>> Id appreciate any insight or experience on this one?
>>
>>
>> Thanks
>>
>> DrewG
>>

From: werD on
Hello Thank you for your response. I have been able to replicate this
behavior with the emulator and with my Device (an HTC wizrd). Generally Im
using SHSetAppKeyWndAssoc for the hardware keys with good response with it.
But, unfortunately, I was unable to get the phone buttons to follow this
pattern( i.e. the phone on and phone off buttons still brought up the phone
menu even if the association was changed) so I resorted to unregistering them
both with api call UnregisterFunc1.
But then the behavior changes.. ( i.e. when i close the app the hardware
buttons return to normal but the phone buttons still dontfunctin at all). I
have found that if I kill the process "cprog.exe" and restart the
associations(only phone not softkey) are restored but the phone drops signal
when the process is killed so this is not a viable solution, but it does lead
me to believe that cprog.exe calls a (possibly undocumented)api call that re
registers the button with its default association. Does this make sense?
Have you ever had to deal with anything like this before or do you possibly
know of an api call that reproduce this effect(re registering phone buttons)?

Thank you for your input, it is greatly appreciated.

"Henryk Birecki" wrote:

> Does it happen on all devices or a specific one? I have not really had
> any troubles with hardware keys using the (Un)RegisterHotkey or
> SHSetKeyAssoc (not sure exactly at the moment if this is the correct
> name) set of API except for hx2100 series of iPaqs on which keys seem
> to freeze.
>
> Henryk Birecki
>
> werD <werD(a)discussions.microsoft.com> wrote:
>
> >Ive been looking into different ways of reinstating the functionality and
> >thought that perhaps i would need to stop the process "cprog.exe" but i
> >downloaded a task manager hoping to find that the handle or process id was
> >persistant and went to close the process as a test and immediately lost
> >phone service!(that would suck if I got a call and went to unlock and answer
> >but dropped instead)
> > So it looks like the only way I can do this is to get RegisterHotKey to
> >work properly
> >
> >for that I at least need to know how to dynamically get the handle for
> >cprog.exe
> >
> >Can anyone suggest a direction to go in to get this acomplished or let me
> >know why my buttons lose all functionality(ie registerhotkey isnt registering
> >or perhaps needs to be flushed?) should i perhaps look into replacing the
> >phone launch program with a launcher through a registry edit that would call
> >the app or hang up(that is if i can get registerhotkey working like it
> >supposed to)? i dont think this would be as easily manageable across devices
> >though its not at all ruled out at the moment.
> >
> >
> >
> >
> >Linkage
> >A Nice Free task manager from a guy who goes by
> >DotFred(http://buzzdev.net/index.php?option=com_phorum&Itemid=125&phorum_query=read,27,15027,page=1)
> >
> >
> >
> >"werD" wrote:
> >
> >> Im running into a problem with a locking app im working on. Im using
> >> UnregisterFunc1 along with RegisterHotkey from coredll.dll to disable
> >> softkeys and phone buttons and such. my problem is that when i use them to
> >> lock and then unlock ie close app the buttons still no longer work until the
> >> device goes through a soft reset. Is there a way that I can get the handle
> >> off the apps needed and set them back to their original hotkeys or a function
> >> to set them back to what they were last laoded as, or is there some other way
> >> to achieve the lock/unlock abilities beyond these? For the hardware keys im
> >> using SHSetAppKeyWndAssoc from aygshell.dll which give the expected results
> >> but im stil unable to stop the windows key from makig it where a user might
> >> accidentally press something in there pocket.
> >>
> >> here's where i disable the soft key. Does anyone know how i can "undo" this?
> >>
> >> Public Enum KeyModifiers
> >> None = 0
> >> Alt = 1
> >> Control = 2
> >> Shift = 4
> >> Windows = 8
> >> End Enum
> >>
> >>
> >> Public Enum vKeys As Byte
> >> 'Hardware Keys 1-6
> >> HardwareKey1 = 193
> >> HardwareKey2 = 194
> >> HardwareKey3 = 195
> >> HardwareKey4 = 196
> >> HardwareKey5 = 197
> >> hardwarekey6 = 198
> >>
> >> 'SoftKeys L/R
> >> SoftKeyLeft = 112
> >> SoftKeyRight = 113
> >>
> >> 'Phone G/R
> >> PhoneOpen = 114
> >> PhoneClose = 115
> >>
> >> End Enum
> >> <DllImport("coredll.dll", SetLastError:=True)> _
> >> Public Shared Function RegisterHotKey(ByVal Handle As IntPtr, ByVal
> >> id As Integer, ByVal Modifiers As UInteger, ByVal key As UInteger) As Boolean
> >>
> >> End Function
> >> <DllImport("coredll.dll")> _
> >> Public Shared Function UnregisterFunc1(ByVal modifiers As KeyModifiers,
> >> ByVal keyID As Integer) As Boolean
> >> End Function
> >>
> >>
> >> UnregisterFunc1(KeyModifiers.None, vKeys.SoftKeyLeft)
> >>
> >> 'I dont think this is running bcause a press of the no unregistered Softkey
> >> does noting even after the app quits
> >> RegisterHotKey(Me.Handle, 0, KeyModifiers.None, vKeys.SoftKeyLeft)
> >>
> >>
> >>
> >>
> >> Id appreciate any insight or experience on this one?
> >>
> >>
> >> Thanks
> >>
> >> DrewG
> >>
>
>