473,395 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

A97 procedure causes keyboard CTRL key to get stuck. Why?

MLH
I use a mouse-down procedure to trap right mouse
clicks and CTRL-Right mouse clicks. Running the
procedure must put honey or some other sticky
substance into my keyboard because subsequent
RightMouseClicks run as if they were CTRL-RightMouseClicks

I have to close the form and reopen it to clear this
behavior. Then, after the first CTRL-RightMouseClick,
it starts all over again.

Would it help if I poured a cup of warm water into
the keyboard? Or, would it be better to hold it over
the kitchen sink and open the hot water valve?
Nov 13 '05 #1
8 2927
Please copy and paste the procedure into a message so that we can see what
you're doing. If the variables aren't declared in the procedure, list where
they are declared and the line used to declare them.

--
Wayne Morgan
MS Access MVP
"MLH" <CR**@NorthState.net> wrote in message
news:ti********************************@4ax.com...
I use a mouse-down procedure to trap right mouse
clicks and CTRL-Right mouse clicks. Running the
procedure must put honey or some other sticky
substance into my keyboard because subsequent
RightMouseClicks run as if they were CTRL-RightMouseClicks

I have to close the form and reopen it to clear this
behavior. Then, after the first CTRL-RightMouseClick,
it starts all over again.

Would it help if I poured a cup of warm water into
the keyboard? Or, would it be better to hold it over
the kitchen sink and open the hot water valve?

Nov 13 '05 #2
MLH
Please copy and paste the procedure into a message so that we can see what
you're doing. If the variables aren't declared in the procedure, list where
they are declared and the line used to declare them.


Thank-you, sir. Per your request, I use this...
PlayHelp = fPlayStuff("C:\Program Files\TowPack\help\Help-70.wav", 1)

to call the following procedure in an A97 standard module...
Function fPlayStuff(ByVal strFilename As String, _
Optional intPlayMode As Integer) As Long
'MUST pass a filename _with_ extension
'Supports Wav, AVI, MID type files
Dim lngRet As Long
Dim strTemp As String

Select Case LCase(fGetFileExt(strFilename))
Case "wav":
If Not IsMissing(intPlayMode) Then
lngRet = apiPlaySound(strFilename, intPlayMode)
Else
MsgBox "Must specify play mode."
Exit Function
End If
Case "avi", "mid":
strTemp = String$(256, 0)
lngRet = apimciSendString("play " & strFilename, strTemp,
255, 0)
End Select
fPlayStuff = lngRet
End Function

The PlayHelp assignment in the first code line above is part of
a mousedown procedure shown here...

Private Sub VehicleChooserbox_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
On Error GoTo ErrorVehicleChooserbox_MouseDown
Dim ThisForm As String
ThisForm = Me.Name

Dim Help As String, MyControl As Control
Set MyControl = Screen.ActiveControl
Help = MyControl.Tag
If Shift = 0 Then
If Button = RIGHT_BUTTON Then MsgBox Help, 64, MyApp$ & ",
rev. " & MY_VERSION$
Else
If Button = RIGHT_BUTTON Then
Select Case Shift
Case SHIFT_MASK
MsgBox "You pressed SHIFT & Rite Mouse Button!"
Case CTRL_MASK
'MsgBox "You pressed CTRL & Rite Mouse Button!"
Dim PlayHelp As Variant
PlayHelp = fPlayStuff("C:\Program
Files\TowPack\help\Help-70.wav", 1)
Case ALT_MASK
MsgBox "You pressed ALT & Rite Mouse Button!"
End Select
End If
End If

ExitVehicleChooserbox_MouseDown:
Exit Sub

ErrorVehicleChooserbox_MouseDown:
Dim r As String, k As String, Message3 As String
r = "The following unexpected error occurred in Sub
VehicleChooserbox_MouseDown, CBF on " & ThisForm & "."
k = CRLF & CRLF & Str$(Err) & ": " & Quote & Error$ & Quote
Message3 = r & k
MsgBox Message3, 48, "Unexpected Error - " & MyApp$ & ", rev. " &
MY_VERSION$
Resume ExitVehicleChooserbox_MouseDown

End Sub

Sometimes, further rite-mouse clicks on the same (or other) controls
launch the CTRL-RiteClik code instead of just the RiteClick stuff. I
have tested, waiting until the audio file finishes playback and NOT
waiting for it to finish. Either way, the CTRL key still acts stuck.
The only way, it seems, to un-stick it is by the active form losing
the focus to another form or the database window. When I come
back to it, the CTRL key is no longer 'stuck'.
Nov 13 '05 #3
MLH
I'm thinking perhaps I could somehow simulate the form losing
focus as a way to "fix" the problem. Would be better if I could
make the problem go away and just not happen. But, it is hap-
pening and I'm going to have to deal with it.

I'll have to solicit some recommendations from the group on
how best to roll that out. Dunno. Its a runtime app designed
for a customer. Whatever I do, I wanna try to make the best
impression I can.
Nov 13 '05 #4
If you comment out the PlayHelp= line (i.e. don't play the file) do you
still have the problem with Ctrl getting stuck or does it only happen when
you play the file? Does it make a difference if you play an avi or mid file
instead of a wav file?

The only thing I see in the code is that you don't set MyControl = Nothing
when you are done with it. It should clean itself up at the end of the
procedure, but sometimes weird things happen and it doesn't do so properly.

--
Wayne Morgan
MS Access MVP
"MLH" <CR**@NorthState.net> wrote in message
news:p5********************************@4ax.com...
Please copy and paste the procedure into a message so that we can see what
you're doing. If the variables aren't declared in the procedure, list
where
they are declared and the line used to declare them.


Thank-you, sir. Per your request, I use this...
PlayHelp = fPlayStuff("C:\Program Files\TowPack\help\Help-70.wav", 1)

to call the following procedure in an A97 standard module...
Function fPlayStuff(ByVal strFilename As String, _
Optional intPlayMode As Integer) As Long
'MUST pass a filename _with_ extension
'Supports Wav, AVI, MID type files
Dim lngRet As Long
Dim strTemp As String

Select Case LCase(fGetFileExt(strFilename))
Case "wav":
If Not IsMissing(intPlayMode) Then
lngRet = apiPlaySound(strFilename, intPlayMode)
Else
MsgBox "Must specify play mode."
Exit Function
End If
Case "avi", "mid":
strTemp = String$(256, 0)
lngRet = apimciSendString("play " & strFilename, strTemp,
255, 0)
End Select
fPlayStuff = lngRet
End Function

The PlayHelp assignment in the first code line above is part of
a mousedown procedure shown here...

Private Sub VehicleChooserbox_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
On Error GoTo ErrorVehicleChooserbox_MouseDown
Dim ThisForm As String
ThisForm = Me.Name

Dim Help As String, MyControl As Control
Set MyControl = Screen.ActiveControl
Help = MyControl.Tag
If Shift = 0 Then
If Button = RIGHT_BUTTON Then MsgBox Help, 64, MyApp$ & ",
rev. " & MY_VERSION$
Else
If Button = RIGHT_BUTTON Then
Select Case Shift
Case SHIFT_MASK
MsgBox "You pressed SHIFT & Rite Mouse Button!"
Case CTRL_MASK
'MsgBox "You pressed CTRL & Rite Mouse Button!"
Dim PlayHelp As Variant
PlayHelp = fPlayStuff("C:\Program
Files\TowPack\help\Help-70.wav", 1)
Case ALT_MASK
MsgBox "You pressed ALT & Rite Mouse Button!"
End Select
End If
End If

ExitVehicleChooserbox_MouseDown:
Exit Sub

ErrorVehicleChooserbox_MouseDown:
Dim r As String, k As String, Message3 As String
r = "The following unexpected error occurred in Sub
VehicleChooserbox_MouseDown, CBF on " & ThisForm & "."
k = CRLF & CRLF & Str$(Err) & ": " & Quote & Error$ & Quote
Message3 = r & k
MsgBox Message3, 48, "Unexpected Error - " & MyApp$ & ", rev. " &
MY_VERSION$
Resume ExitVehicleChooserbox_MouseDown

End Sub

Sometimes, further rite-mouse clicks on the same (or other) controls
launch the CTRL-RiteClik code instead of just the RiteClick stuff. I
have tested, waiting until the audio file finishes playback and NOT
waiting for it to finish. Either way, the CTRL key still acts stuck.
The only way, it seems, to un-stick it is by the active form losing
the focus to another form or the database window. When I come
back to it, the CTRL key is no longer 'stuck'.

Nov 13 '05 #5
MLH
>If you comment out the PlayHelp= line (i.e. don't play the file) do you
still have the problem with Ctrl getting stuck or does it only happen when
you play the file? I'm gonna have to test that. The only tests I've done in the past tell
me the answer is "Yes, it only sticks when playing wav files". Past
tests, I seem to remember, have shown the prob not to happen when I
simply have msgbox's that say "You pressed CTRL-RiteClik" or "You
pressed SHIFT-RiteClik" ... that sort of thing.
Does it make a difference if you play an avi or mid file
instead of a wav file? Well, after much testing... I get the sticky-keys syndrome after mids,
avi's and wav's and not only CTRL sticks - SHIFT, ALT do as well.
I found that ANY keyboard activity between attempts will UNSTICK
the sticky key, as will form losing focus briefly to database window
or other form. And, NOTHING sticks if I just have msgbox commands
in there - only media files elicit the ill behavior.

The only thing I see in the code is that you don't set MyControl = Nothing
when you are done with it. It should clean itself up at the end of the
procedure, but sometimes weird things happen and it doesn't do so properly.

On a line by itself, MyControl = Nothing produces an error #2448
"You can't assigna a value to this object. The object may be a control
on a read-only form. The object may be on a form that is open in
Design view. The value may be too large for this field."

Nov 13 '05 #6
MLH
Excuse me, I goofed. Changing the statment to
Set MyControl = Nothing (the correct syntax for object var)
produces no error.

Sorry about that.

However, it did not fix the sticky-key syndrome. I have not
yet tested from a machine with hard-wired mouse & keyboard.
Could be dilemma is related to wireless mouse/keyboard, dunno.
Nov 13 '05 #7
MLH
I have a sneaky feeling this is a hardware-specific issue.
Lets not waste too much more time on it until I've had a
chance to test it on a machine with a wired keyboard and
mouse. Will pick up the thread again. Thx for your input
and sharing your ideas.
Nov 13 '05 #8
It "shouldn't" matter how the keyboard and mouse are connected. Since the
problem only occurs when you actually play the multimedia file, it appears
that there is something that isn't getting closed properly after playing the
file, but I'm not familiar enough with the API calls that play the files to
help with that. If simply moving the focus to another form and back again
helps, you may want to check the Application.Echo command to freeze the
screen for a moment while you do that so that it won't be visible to the
user.

--
Wayne Morgan
MS Access MVP
"MLH" <CR**@NorthState.net> wrote in message
news:sk********************************@4ax.com...
I'm thinking perhaps I could somehow simulate the form losing
focus as a way to "fix" the problem. Would be better if I could
make the problem go away and just not happen. But, it is hap-
pening and I'm going to have to deal with it.

I'll have to solicit some recommendations from the group on
how best to roll that out. Dunno. Its a runtime app designed
for a customer. Whatever I do, I wanna try to make the best
impression I can.

Nov 13 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: dixie | last post by:
I want to run an event when I press the Ctl key simultaneously with the K key. How do I achieve this in VBA? dixie
4
by: Billy | last post by:
Anybody know if maybe in VS 2003 IDE exist any keyboard shortcut for quick moving from one procedure up or down like is that in VBA IDE? I can't find anything about that in help under Keyboard...
5
by: BartlebyScrivener | last post by:
Running Python on Win XP. When running commands with the interpreter, if you get stuck in a while loop, is there a keyboard command to break out of it? Or is the only way out a triple-finger...
331
by: Xah Lee | last post by:
http://xahlee.org/emacs/modernization.html ] The Modernization of Emacs ---------------------------------------- THE PROBLEM Emacs is a great editor. It is perhaps the most powerful and...
1
by: pinkfloydhomer | last post by:
I am writing a curses application, but the getch() does not seem to give me all I want. Of course, if I press "d", it returns an ord("d") and so on. But I want to be able to detect whether alt,...
1
by: lolly | last post by:
hi i recently used a virtual keyboard from www.codeproject.com/jscript/jvk.asp. However this part of the code function keyb_callback(ch) { var text =...
1
by: =?Utf-8?B?V2hpdGUgUGhvZW5peA==?= | last post by:
I have a notebook, and therefore am working on the standard condensed version of a keyboard. I type fast, and with this psrticular keyboard, I have a tendancy to hit the Shift and Ctrl, or some...
7
by: RADAR | last post by:
i use VC++ 6,0 and i have problems with getting keyboard system inputs and to use them to check to proceed or break the loop. for example if i want to proceed until Ctrl+z is written for input.What...
8
by: BD | last post by:
How can I duplicate the behavior of the operating system shortcut keys in my application? For example, my windows form has 5 controls (textboxes), the operating system will pickup which control...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.