TonySelke
Fri Jul 21 21:35:01 CDT 2006
Thank you for your reply. This does work in WM2003, however in WM5, it does
not capture the "Windows" button (which activates the Start menu). The C#
code that we used to validate this came from Microsoft's Input class in this
example:
http://msdn.microsoft.com/library/en-us/dnnetcomp/html/PInvokeLib.asp
In fact, this class captures all hardware buttons on the WM2003 emulator,
but the ONLY button it captures in the WM5.0 emulator is the calendar button.
The other buttons don't even get passed to the MessageWindow.WndProc()
function. All of the other buttons can be captured using the built-in CF2
classes, but the "Windows" button that opens the pop-up Start menu still
eludes us.
Tony
"dule" wrote:
> Hi,
> I have encountered the simillar problem on the Recon device and this is how
> I have solved it:
>
> typedef BOOL (__stdcall *UnregisterFunc1Proc)( UINT, UINT );
>
>
> void DisableWinKey (HWND hWnd)
> {
> HINSTANCE hCoreDll;
> UnregisterFunc1Proc procUndergisterFunc;
> hCoreDll = LoadLibrary(_T("coredll.dll"));
> ASSERT(hCoreDll);
>
> procUndergisterFunc = (UnregisterFunc1Proc)GetProcAddress(hCoreDll,
> _T("UnregisterFunc1"));
>
> ASSERT(procUndergisterFunc);
>
> int i=0x5b;
> procUndergisterFunc(MOD_WIN, i);
> RegisterHotKey(hWnd, i, MOD_WIN, i);
>
>
> FreeLibrary(hCoreDll);
>
> }
>
> Just call this function at the start of your program. The value of variable
> 'i' I have found with Remote Spy by watching the messages that are sent when
> theWin key is pressed. Maybe that value is different on your device.
>
> Hope this helps,
> Dusko
>
>
>
>
> "Tony Selke" <TonySelke@discussions.microsoft.com> wrote in message
> news:C6FD4C10-3185-4F4D-88E7-5FA94869D25A@microsoft.com...
> > We are using C# with the CF v2.0 on WM 5.0. We have a requirement to trap
> > hardware buttons to prevent the associated actions while a particular
> > application has the focus. My team has had had no trouble doing this with
> > the HardwareButton & HardwareKeys entities for "normal" buttons, however
> > this
> > process does not seem to work with the "Windows" button that (typically)
> > brings up the "Start Menu" pop-up. We even tried a
> > WindowSink:MessageWindow
> > with a WndProc(Message) handler, but that doesn't get called by the button
> > either. None of us has been successful in finding an answer. Is there
> > something that will work?
>
>
>