Win Key

  • Thread starter Thread starter Jarod_24
  • Start date Start date
J

Jarod_24

Finding out if Alt, Ctrl or Shift has been pressed is easy, but what to do
with the Win-key?

Example:

Dim strHotkey as String = "Win+Ctrl+NumPad0"
Dim hot_key As Keys = CType(New
KeysConverter().ConvertFromString(strHotkey), Keys)

'These work
If ((hot_key And Keys.Alt) <> 0) Then myHotKey2.Altkey = True
If ((hot_key And Keys.Control) <> 0) Then myHotKey2.ControlKey = True
If ((hot_key And Keys.Shift) <> 0) Then myHotKey2.ShiftKey = True

'These do not
If ((hot_key And Keys.LWin) <> 0) Then myHotKey2.WinKey = True
If ((hot_key And Keys.RWin) <> 0) Then myHotKey2.WinKey = True

I know it's because that the WinKey's dosent' have a Modifier-bitpattern
like the other key's but is there any other way to find out if the Win Key
is one of the Keys that have been pressed.
 
Jarod_24 said:
Finding out if Alt, Ctrl or Shift has been pressed is easy, but what
to do with the Win-key?

Example:

Dim strHotkey as String = "Win+Ctrl+NumPad0"
Dim hot_key As Keys = CType(New
KeysConverter().ConvertFromString(strHotkey), Keys)

I can't reproduce it because ConvertFromString throws an exception because
'Win' can not be found.
 
Armin Zingler said:
I can't reproduce it because ConvertFromString throws an exception because
'Win' can not be found.

Sorry.

try this:

Dim strHotkey as String = "LWin+Ctrl+NumPad0"

or this:

Dim strHotkey as String = "RWin+Ctrl+NumPad0"
 
Jarod_24 said:
Sorry.

try this:

Dim strHotkey as String = "LWin+Ctrl+NumPad0"

or this:

Dim strHotkey as String = "RWin+Ctrl+NumPad0"

ArgumentException: "...'Ctrl' can not be found..."

Tried several combinations (also localized (German) words). If not getting
the ArgumentException, I'm getting a FormatException: "ressource string
'KeysConverterInvalidKeyCombination' not found")

Sorry, failed in trying to help you.
 
Well, just pressing CTRL+ESC is a another shortcut for just pressing the WIN
key.....
 
Yes, but WinKey + R loads run, WinKey + E loads explorer, WinKey + F loads
find, WinKey + M is minimize all, etc... Ctrl+Esc+R doesn't load Run... I
believe he's trying to create a hotkey for the Windows Key.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations
 
Back
Top