Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

Accessing the tablet buttons in IE

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Kron - 19 Sep 2004 22:07 GMT
I'd like to use the tablet buttons for navigation on a WinForms control I'm
writing, which will be hosted by IE.

However, the tablet buttons are typically mapped to VK_UP and VK_DOWN which
get trapped by the control for scrolling and don't generate OnKeyDown
events. To get at them, you typically override ProcessCmdKey. The problem is
that this requires UIPermission.AllWindows and you don't get that with a
control downloaded by IE.

Is there a way to handle these buttons without requiring more than the
default Internet CAS trust?

Thanks
Stefan Wick[MS] - 25 Sep 2004 16:43 GMT
Hello Peter,

you can sink the OnKeyDown in script code off your web page's body and
forward the key code to your Winforms control. Would that work for your
scenario?

See sample C# and HTML code below.

using System;
using System.Drawing;
using System.Windows.Forms;

namespace WebControl
{
public class MyControl : UserControl
{
 Label label;

 public MyControl()
 {
  label = new Label();
  label.Parent = this;
 }

 public void ForwardKeyDown(object o)
 {
  label.Text = o.ToString();
 }
}
}

------

<html>
<HEAD>
<script language="jscript">
function KeyDown()
{
myControl.ForwardKeyDown(event.keyCode);
}
</script>
</HEAD>
<body onkeydown="KeyDown()">
<OBJECT id="myControl" height="80%" width="80%" border="1"
classid="ClassLibrary1.dll#WebControl.MyControl"/>
</body>
</HTML>

Thanks,
Stefan Wick
Signature

This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

> I'd like to use the tablet buttons for navigation on a WinForms control
> I'm writing, which will be hosted by IE.
[quoted text clipped - 9 lines]
>
> Thanks
Peter Kron - 27 Sep 2004 02:26 GMT
That's what I eventually figured out. Thanks for the response!

> Hello Peter,
>
[quoted text clipped - 59 lines]
>>
>> Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.