I can use Control.ModifierKeys to determine if a modifying key is pressed
when executing MouseDown event, but how can I determine if an "M" was
pressed??
Possible? Can't find a clue in Control doc.
Cal 4 2994
Cal, Possible? Can't find a clue in Control doc.
I wonder if your users would have a clue to press "M" while clicking with a
mouse! As it sounds like a very non-standard user interface.
If you have a real need for this requirement, I would consider handling the
KeyDown & KeyUp events setting a flag when the "M" key is down. Then in the
MouseDown event I would check the flag.
Of course Win32 already does this for you. You should be able to use either
the GetKeyState or GetAsyncKeyState Win32 API to check the state of the "M"
key.
Declare Auto Function GetKeyState Lib "user32.dll" (ByVal vKey As Keys)
As Short
Declare Auto Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As
Keys) As Short
Debug.WriteLine(GetKeyState(Keys.M))
Debug.WriteLine(GetAsyncKeyState(Keys.M))
Note look up GetKeyState & GetAsyncKeyState for specifics on the value
returned.
Note: The above functions may already be exposed in the Framework, however I
have not come across them yet.
Hope this helps
Jay
" active" <ac****@REMOVEa-znet.com> wrote in message
news:O8**************@TK2MSFTNGP09.phx.gbl... I can use Control.ModifierKeys to determine if a modifying key is pressed when executing MouseDown event, but how can I determine if an "M" was pressed?? Possible? Can't find a clue in Control doc. Cal
GetAsyncKeyState seems to fit perfectly. Just check for <0 to see if it's
down at the time of the check. Is the value of "Keys.something" exactly the
same a the virtual key code o "something"?
Thanks a lot
Cal
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Cal, Possible? Can't find a clue in Control doc. I wonder if your users would have a clue to press "M" while clicking with
a mouse! As it sounds like a very non-standard user interface.
If you have a real need for this requirement, I would consider handling
the KeyDown & KeyUp events setting a flag when the "M" key is down. Then in
the MouseDown event I would check the flag.
Of course Win32 already does this for you. You should be able to use
either the GetKeyState or Win32 API to check the state of the "M" key.
Declare Auto Function GetKeyState Lib "user32.dll" (ByVal vKey As
Keys) As Short Declare Auto Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Keys) As Short
Debug.WriteLine(GetKeyState(Keys.M)) Debug.WriteLine(GetAsyncKeyState(Keys.M))
Note look up GetKeyState & GetAsyncKeyState for specifics on the value returned.
Note: The above functions may already be exposed in the Framework, however
I have not come across them yet.
Hope this helps Jay
" active" <ac****@REMOVEa-znet.com> wrote in message news:O8**************@TK2MSFTNGP09.phx.gbl... I can use Control.ModifierKeys to determine if a modifying key is
pressed when executing MouseDown event, but how can I determine if an "M" was pressed?? Possible? Can't find a clue in Control doc. Cal
Cal, Is the value of "Keys.something" exactly the same a the virtual key code o "something"?
According to Charles Petzold's book "Programming Microsoft Windows With
Microsoft Visual Basic .NET" from MS Press it is.
The Keys Enum is all the valid virtual key that you can pass to
GetAsyncKeyState, which means you can use it to check for Function Keys,
Caps Lock, Scroll Lock and other and any other non-char key you want.
I was originally going to give you:
Declare Auto Function GetKeyState Lib "user32.dll" (ByVal vKey As Char)
As Short
Declare Auto Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As
Char) As Short
However you would have problems trying to check for CapsLock and you would
have to be certain to use only upper case letters. You could also make vKey
as Short, however then you would need to know all the "magic" numbers, Keys
Enum just happens to define all the magic numbers for you. I find using an
existing Enum or defining my own Enum very beneficial when defining API
calls...
Hope this helps
Jay
" active" <ac****@REMOVEa-znet.com> wrote in message
news:uu**************@TK2MSFTNGP12.phx.gbl... GetAsyncKeyState seems to fit perfectly. Just check for <0 to see if it's down at the time of the check. Is the value of "Keys.something" exactly
the same a the virtual key code o "something"?
Thanks a lot Cal
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... Cal, Possible? Can't find a clue in Control doc. I wonder if your users would have a clue to press "M" while clicking
with a mouse! As it sounds like a very non-standard user interface.
If you have a real need for this requirement, I would consider handling the KeyDown & KeyUp events setting a flag when the "M" key is down. Then in the MouseDown event I would check the flag.
Of course Win32 already does this for you. You should be able to use either the GetKeyState or Win32 API to check the state of the "M" key.
Declare Auto Function GetKeyState Lib "user32.dll" (ByVal vKey As Keys) As Short Declare Auto Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey
As Keys) As Short
Debug.WriteLine(GetKeyState(Keys.M)) Debug.WriteLine(GetAsyncKeyState(Keys.M))
Note look up GetKeyState & GetAsyncKeyState for specifics on the value returned.
Note: The above functions may already be exposed in the Framework,
however I have not come across them yet.
Hope this helps Jay
" active" <ac****@REMOVEa-znet.com> wrote in message news:O8**************@TK2MSFTNGP09.phx.gbl... I can use Control.ModifierKeys to determine if a modifying key is pressed when executing MouseDown event, but how can I determine if an "M" was pressed?? Possible? Can't find a clue in Control doc. Cal
Either it was not out at that time or I it was and I didn't know it so I
bought his C# book some time ago.
Thanks for the info
Cal
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Cal, Is the value of "Keys.something" exactly the same a the virtual key code o "something"? According to Charles Petzold's book "Programming Microsoft Windows With Microsoft Visual Basic .NET" from MS Press it is.
The Keys Enum is all the valid virtual key that you can pass to GetAsyncKeyState, which means you can use it to check for Function Keys, Caps Lock, Scroll Lock and other and any other non-char key you want.
I was originally going to give you:
Declare Auto Function GetKeyState Lib "user32.dll" (ByVal vKey As
Char) As Short Declare Auto Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Char) As Short
However you would have problems trying to check for CapsLock and you would have to be certain to use only upper case letters. You could also make
vKey as Short, however then you would need to know all the "magic" numbers,
Keys Enum just happens to define all the magic numbers for you. I find using an existing Enum or defining my own Enum very beneficial when defining API calls...
Hope this helps Jay
" active" <ac****@REMOVEa-znet.com> wrote in message news:uu**************@TK2MSFTNGP12.phx.gbl... GetAsyncKeyState seems to fit perfectly. Just check for <0 to see if
it's down at the time of the check. Is the value of "Keys.something" exactly the same a the virtual key code o "something"?
Thanks a lot Cal
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl... Cal, > Possible? Can't find a clue in Control doc. I wonder if your users would have a clue to press "M" while clicking with a mouse! As it sounds like a very non-standard user interface.
If you have a real need for this requirement, I would consider
handling the KeyDown & KeyUp events setting a flag when the "M" key is down. Then
in the MouseDown event I would check the flag.
Of course Win32 already does this for you. You should be able to use either the GetKeyState or Win32 API to check the state of the "M" key.
Declare Auto Function GetKeyState Lib "user32.dll" (ByVal vKey As Keys) As Short Declare Auto Function GetAsyncKeyState Lib "user32.dll" (ByVal
vKey As Keys) As Short
Debug.WriteLine(GetKeyState(Keys.M)) Debug.WriteLine(GetAsyncKeyState(Keys.M))
Note look up GetKeyState & GetAsyncKeyState for specifics on the value returned.
Note: The above functions may already be exposed in the Framework, however I have not come across them yet.
Hope this helps Jay
" active" <ac****@REMOVEa-znet.com> wrote in message news:O8**************@TK2MSFTNGP09.phx.gbl... > I can use Control.ModifierKeys to determine if a modifying key is pressed > when executing MouseDown event, but how can I determine if an "M"
was > pressed?? > > > > Possible? Can't find a clue in Control doc. > > > > Cal > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: JJ |
last post by:
Hi All,
I need to create a MouseDown event for a picture box . Am I doing the
following right?
pictureBox.MouseDown += new
System.WinForms.MouseEventHandler(pictureBox_MouseDown)
Then
|
by: MrNobody |
last post by:
Say I want to do a specific action if the user holds down the CTRL key while
clicking something in my UI- how can I determine if this key is currently
pressed within the mouse event?
|
by: active |
last post by:
In VB6 I believe MouseDown had a Shift argument that told if Shift, Ctrl or
Alt was pressed.
How in VB.NET MouseDown do I determine if one of these keys is pressed?
I could increment a global...
|
by: ngreplies |
last post by:
I have a need for an extra facility to be available when the user presses
the SHIFT key whilst clicking on either a Button Control or a textbox.
I am using both VB6 and VB.NET2002.
Could anyone...
|
by: Techsatish |
last post by:
how to make a mouseup event called only once during a double click
event?
here double click is made on a tree node in a tree control.
I have the code inside mouseup event....in runtime the...
|
by: marss |
last post by:
Hi,
How can I define in Firefox whether the left mouse button is pressed
when I move mouse over a html element?
The documentation says that "e.button == 0 for standard 'click',
usually left...
|
by: Maciej S |
last post by:
Hi,
I would like to move a UserControl in a drag-and-drop way (user clicks on control and while the button is down the control changes its location fallowing the mouse).
I start the drag...
|
by: phcmi |
last post by:
Within a mousedown event, can you please show a code sample of how to
ascertain whether the CTRL and/or ALT and/or SHIFT keyboard key is pressed?
Thank you
|
by: hzgt9b |
last post by:
Using VS2005, VB.NET,
I am developing a windows app that has a DataGridView. I want to
enable the display of a context menu on this DataGridView only when a
specific set of keys is also pressed...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |