Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Code in vb.net in key down event works in Windows XP but not in Win7 ?

Posted on 2012-09-07
9
Medium Priority
?
435 Views
Last Modified: 2013-02-03
I have written code in vb.net where i assign character to Control+D and Alt+D.
Both these work fine in Win XP
but in Win7 only Control+D works but Alt+D does not work.
This was observed on a 64 bit machine.
0
Comment
Question by:gawacha1
  • 5
  • 4
9 Comments
 
LVL 65

Expert Comment

by:btan
ID: 38378805
Saw a sample for all .NET framework but they did not listed XP though
http://msdn.microsoft.com/en-us/library/system.windows.forms.keys.aspx

and even platform support for .net
http://msdn.microsoft.com/en-us/library/8z6watww.aspx

Wondering if you using the similar codes
0
 

Author Comment

by:gawacha1
ID: 38381879
Dear breadtan
my problem is that that same code for 'Alt D' key-replacement works in WinXP but not in Win7
Regards
0
 
LVL 65

Expert Comment

by:btan
ID: 38382551
Are you using either of the below to detect Alt key and is working (not to say even Alt+D)?

\\\-----------------
If (Windows.Forms.Control.ModifierKeys And Keys.Control) <> 0 Then
Debug.WriteLine("Ctrl is pressed")
End If
If (Windows.Forms.Control.ModifierKeys And Keys.Shift) <> 0 Then
Debug.WriteLine("Shift is pressed")
End If
If (Windows.Forms.Control.ModifierKeys And Keys.Alt) <> 0 Then
Debug.WriteLine("Alt is pressed")
End If
///-----------------

\\\-----------------
If (My.Computer.Keyboard.AltKeyDown) Then
or
If (My.Computer.Keyboard.CtrlKeyDown) Then
or
If (My.Computer.Keyboard.ShiftKeyDown) Then
///-----------------
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 65

Expert Comment

by:btan
ID: 38382557
Also on the "Form.KeyPreview" Property, when it is set to true, the form will receive all KeyPress, KeyDown, and KeyUp events. This is applicable for the first example code in my earlier feedback above

http://msdn.microsoft.com/en-us/library/system.windows.forms.form.keypreview(v=vs.71).aspx
0
 

Author Comment

by:gawacha1
ID: 38398194
I have done keypreview true. i have done e.handled=true.
If e.Alt And e.keycode=keys.D Then

e.handled=true
Textbox1.selectedText="a"

End If
This works fine in WinXP but not in Win7 / 64bit
0
 
LVL 65

Expert Comment

by:btan
ID: 38399015
Wouldnt know why but seems like the requirement did not explicity state whether 32 or 64 bits. thinking whether even e.Alt alone can be detected ? trying to isolate which is the culprit key and I suspect Alt...

also if we will to run the appl in XP mode ... wonder if that can help
http://windows.microsoft.com/is-IS/windows7/install-and-use-windows-xp-mode-in-windows-7
0
 

Author Comment

by:gawacha1
ID: 38412438
Dear Breadtan
I m myself not clear on this
will revert
Regards
0
 

Author Comment

by:gawacha1
ID: 38439929
Dear Breadtan

Alt D code is not working in 64bit Windows7.

Kindly suggest solution

Regards
0
 
LVL 65

Accepted Solution

by:
btan earned 2000 total points
ID: 38440087
Will you want to try the registrykey apiece for alt d in the link

http://stackoverflow.com/questions/5619481/what-keys-are-represented-by-the-h-hex-codes
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The way I use Experts Exchange to assist me in analyzing and diagnosing a problem is I first enter a Verbose Question at Experts Exchange like: Office 2007 will hang when opening and saving files I then launch WordPad (any text editor will do) an…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question