By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,058 Members | 1,217 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,058 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
8 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.