473,796 Members | 2,434 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
RightMouseClick s run as if they were CTRL-RightMouseClick s

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 2950
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**@NorthStat e.net> wrote in message
news:ti******** *************** *********@4ax.c om...
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
RightMouseClick s run as if they were CTRL-RightMouseClick s

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\h elp\Help-70.wav", 1)

to call the following procedure in an A97 standard module...
Function fPlayStuff(ByVa l 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(fGetFileE xt(strFilename) )
Case "wav":
If Not IsMissing(intPl ayMode) Then
lngRet = apiPlaySound(st rFilename, intPlayMode)
Else
MsgBox "Must specify play mode."
Exit Function
End If
Case "avi", "mid":
strTemp = String$(256, 0)
lngRet = apimciSendStrin g("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 VehicleChooserb ox_MouseDown(Bu tton As Integer, Shift As
Integer, X As Single, Y As Single)
On Error GoTo ErrorVehicleCho oserbox_MouseDo wn
Dim ThisForm As String
ThisForm = Me.Name

Dim Help As String, MyControl As Control
Set MyControl = Screen.ActiveCo ntrol
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\h elp\Help-70.wav", 1)
Case ALT_MASK
MsgBox "You pressed ALT & Rite Mouse Button!"
End Select
End If
End If

ExitVehicleChoo serbox_MouseDow n:
Exit Sub

ErrorVehicleCho oserbox_MouseDo wn:
Dim r As String, k As String, Message3 As String
r = "The following unexpected error occurred in Sub
VehicleChooserb ox_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 ExitVehicleChoo serbox_MouseDow n

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**@NorthStat e.net> wrote in message
news:p5******** *************** *********@4ax.c om...
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\h elp\Help-70.wav", 1)

to call the following procedure in an A97 standard module...
Function fPlayStuff(ByVa l 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(fGetFileE xt(strFilename) )
Case "wav":
If Not IsMissing(intPl ayMode) Then
lngRet = apiPlaySound(st rFilename, intPlayMode)
Else
MsgBox "Must specify play mode."
Exit Function
End If
Case "avi", "mid":
strTemp = String$(256, 0)
lngRet = apimciSendStrin g("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 VehicleChooserb ox_MouseDown(Bu tton As Integer, Shift As
Integer, X As Single, Y As Single)
On Error GoTo ErrorVehicleCho oserbox_MouseDo wn
Dim ThisForm As String
ThisForm = Me.Name

Dim Help As String, MyControl As Control
Set MyControl = Screen.ActiveCo ntrol
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\h elp\Help-70.wav", 1)
Case ALT_MASK
MsgBox "You pressed ALT & Rite Mouse Button!"
End Select
End If
End If

ExitVehicleChoo serbox_MouseDow n:
Exit Sub

ErrorVehicleCho oserbox_MouseDo wn:
Dim r As String, k As String, Message3 As String
r = "The following unexpected error occurred in Sub
VehicleChooserb ox_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 ExitVehicleChoo serbox_MouseDow n

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.Ech o 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**@NorthStat e.net> wrote in message
news:sk******** *************** *********@4ax.c om...
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
2259
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
1297
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 shortcuts. In VBA you press Ctrl+UpArrow or Ctrl+DownArrow and you move quickly to second line of next or previous procedure. Actually the same work in Ms Word for quick moving from paragraph to paragraph. It's seem to me very handy and I miss that...
5
27172
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 salute and End Task? rd
331
14990
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 most versatile text editor. And, besides text editing, it also serves as a
1
5290
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, shift or ctrl has been pressed also. Shift is normally covered by returning an uppercase character instead and ctrl seems to return control codes (as is normal, I guess), but alt I can't detect with getch, it seems. Preferably, I would like one...
1
4716
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 = document.getElementById("textfield"), val = text.value; switch(ch) { case "BackSpace":
1
11404
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 other button at the same time... That said, I am experiences many instances, where by doing this, I accidentaly activate a French foreign language shortcut. (i.e. when I attempt to insert quotations, instead an È appears, among other various...
7
3418
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 will the compiler do?Does it accept Ctrl+Z as a normal string input , char* input, or a char input which has ASCII 26... suppose i have a loop that does the following: -first check the choice -if not Ctlr+Z continue -else go to the next stage. ...
8
5303
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 has the focus and handle ctrl-c, ctrl-v, or any other shortcuts. I have the same shortcuts working in my app, but have not determined how to find out which control has focus. Would I set up a loop or code for each control at form level. Any help...
0
9680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10228
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10173
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10006
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.