Capturing events

C

Charles Jenkins

I need to see keyboard events before Win CE and the Compact Framework
hide them from me. I found a neat example program called "WindowHook"
on the Internet, but it depends upon being able to get the Handle of a
Control.

All of my documentation (MSDN, Internet searches, etc) says that
System.Windows.Forms.Control.Handle is a property that exists in
Compact Framework 2.0, but my compiler says that "Control has no
property 'Handle'"

Because of this disagreement between documentation and my project, I
begin to suspect that my project is not really building against CF 2.0

Would someone who knows they are really, really using CF 2.0 compile a
C# file that accesses Control.Handle and tell me if it works?

Thanks!
 
G

Guest

Controls in CF 2.0 definitely *do* expose the Handle property. CF 1.0 does
not. Clikc on the project in the solution explorer and look at the
Properties pane - it will show you a "Framework Version" entry.
 
F

Fabien

Hi,

You can use P/Invoke to call FindWindow.


[DllImport("coredll.dll", EntryPoint="FindWindow")]
public static extern int FindWindow(string lpClassName, string
lpWindowName);

BR


Fabien Decret
Windows Embedded Consultant

ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/
 
G

Guest

SetCapture/GetCapture is a better mechanism in CF 1.0. In 2.0, there's no
need to P/Invoke at all.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


Hi,

You can use P/Invoke to call FindWindow.


[DllImport("coredll.dll", EntryPoint="FindWindow")]
public static extern int FindWindow(string lpClassName, string
lpWindowName);

BR


Fabien Decret
Windows Embedded Consultant

ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/
 
C

Charles Jenkins

Controls in CF 2.0 definitely *do* expose the Handle property. CF 1.0
does not. Clikc on the project in the solution explorer and look at
the Properties pane - it will show you a "Framework Version" entry.

Thanks! I discovered that my project was indeed compiled agains CF 1.0

Chris, while I have your attention, I am considering buying the
OpenNETCF Smart Device Framework, but I am not sure it will do what I
need and I cannot get a reply from the support email address to even
tell me whether SDF is what I really need.

I am trying to write a custom grid control, and I would like for it to
operate both on the PC and on Windows CE. The problem is, of course, CE
handles tab and arrow keys without passing them through the message
loop, so my grid has no chance either to respond to them OR to prevent
the default behavior of changing the focused control.

A colleague wrote for me a C++ dll containing "thunks" to API
functions, such that when we are running on Win32 the API calls go to
user32.dll and when we are running on CE the API calls go to
coredll.dll. It seems to work, and with that dll in place, I can write
C# code to subclass a window and override WndProc() so that it will
perform custom message handling. Even with all of this working, it
seems that the tab and arrow keys never even make it to the window's
message loop.

Does the SDF provide a way to capture tab and arrow keys, respond to
them, and prevent them from changing the focus?

Will applications compiled with the SDF run on both Windows CE for
deployment AND on the desktop for testing?

I expect the answer to one or both of those questions will be "no," but
it doesn't hurt to ask...

Thanks!
 
G

Guest

I'm not certain exactly what you're after, but an IMessageFilter (in the
SDF) would likely provide the hook you're after at an application level.
It's not directly desktop compatible, but it follows the same interface as
that on the desktop, so making it portable should be very few lines of code.

You can always download the Community Edition, which is free, and see if it
works.
 
C

Charles Jenkins

I'm not certain exactly what you're after...

I wish I could find the right words to explain. I have asked questions
about capturing tab and arrow key on various forums and never gotten a
reply that led me to success.

Thanks anyhow! :)
 
G

Guest

My confusion every time you ask this is your statement that "...CE
handles tab and arrow keys without passing them through the message
loop...." Every device I've every used the tab and cursor keys worked,
which means they are in fact getting sent to the application, so CE is
dispatching them just like any other key. So you are likely seeing or
misinterpreting some behavior that I, and probably anyone else, don't
understand.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top