just like my thread title... i would like to display the tooltips text directly or automatically when the caps lock is on, regardless the mouse pointer location.
Re: Show tooltips text directly when caps lock is on
It would be a whole lot simpler to display a message in a status bar when the CAPS lock is not than it would be to make a tooltip appear out of the ether.
Re: Show tooltips text directly when caps lock is on
Hello to all, new guy here. This post tickled my interest so I've been messing with code for it since it was posted. Why anyone would want to use the Caps Lock key to turn ToolTips on and off is beyond me. Testing this code was quite irritating because the Caps Lock was sometimes forgotten when I was entering code. None the less this code does a fair job of accomplishing what you want to do.
Just learning.
CDRIVE
Option Explicit
Dim vaL As Integer ' An integer that's returned on each KeyDown event
Dim caP1 As String
Dim caP2 As String
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
vaL = Not vaL = True ' This line off code is what makes this program work!
Print vaL ' This code can be removed. Used for testing purposes only.
If vaL = 0 And KeyCode = vbKeyCapital Then
RichTextBox1.ToolTipText = caP2
Text1.ToolTipText = caP1
ElseIf vaL = -1 And KeyCode = vbKeyCapital Then
RichTextBox1.ToolTipText = ""
Text1.ToolTipText = ""
End If
End Sub
Private Sub Form_Load()
Form1.KeyPreview = True
caP1 = "Text1 Tool Tip!" 'Tool Tip message
caP2 = "RichTextBox1 Tool Tip"
vaL = -1
Show
Print " Press the Capslock key. The Tool Tips will toggle on & off on each key down event."
Print " The KeyDown event doesn't know if the Capslock key is on or off. It only knows"
Print " that a KeyDown event accured! If the Capslock is on when you run the program, then"
Print " the ToolTips will be ON when the Capslock is OFF!"
RichTextBox1.Text = ""
Text1 = ""
End Sub
Re: Show tooltips text directly when caps lock is on
Originally Posted by CDRIVE
Why anyone would want to use the Caps Lock key to turn ToolTips on and off is beyond me.
Its usually used on password fields.
The Windows login dialogue box uses a BallonTip. The display of these can be controlled via API functions. I am sure there are some examples out there in the Codebank or the rest of the net.
Re: Show tooltips text directly when caps lock is on
Originally Posted by ashly
anyone who tried the article posted by zeezee, please shared out opinions here.
i tried, but got errors on the downloaded project
key Ashly, sorry i didnt try this before posting. But now I tried and works.
You have to download the refferences SSubTmr.dll in order to work it out.
Download using this link and register with regsvr32, then you can work it out.
However the Exe provided in the demo works, but the project doesnt work. It gives error that it can find the manifest file. Its because the path for the manifestfile is worng in the project. I tried to fix this , but still the manifest file is not loaded properly.
I ll see and tell you.
Cheers
Re: Show tooltips text directly when caps lock is on
Hey, even if the project doesnt work, when I create and EXe from it , the EXe works. You can remove the referrence to tha manifest file int VBP file, then load the project. It s not needed for the project to work (it seems.)
I have attached the changed project file also.
Thing is, you can make the exe in many names like test1.exe, test2.exe, etc ...
But you have to have the manifest file in the same name as the exe.
like test1.exe.manifest, test2.exe.manifest, ...
Change the given manifest file's name according to the exe you create. It should work. It works for this project.
Another thing, please refer to this Article also. It says how to get this in the VB6 IDE. download the manifest file for VB6 and copy it to the folder where VB6.exe is located.In my machine its in "C:\Program Files\Microsoft Visual Studio\VB98" folder. then it works in the project also. its a cool stuff. I should add it to my project also.
PS : Since I didnt want his in all y project, I did something to have two vb6 IDE's. I renamed manifest file as VB2.exe.manifest and made a copy of vb6.exe as vb62.exe.
So I have two IDEs, one with normal VB6 Look and Feel and aone with XP Style look and feel.
Cheers.
Last edited by zeezee; Aug 5th, 2007 at 11:01 PM.
Reason: Additions
Re: Show tooltips text directly when caps lock is on
Originally Posted by zeezee
Hey, even if the project doesnt work, when I create and EXe from it , the EXe works. You can remove the referrence to tha manifest file int VBP file, then load the project. It s not needed for the project to work (it seems.)
I have attached the changed project file also.
Thing is, you can make the exe in many names like test1.exe, test2.exe, etc ...
But you have to have the manifest file in the same name as the exe.
like test1.exe.manifest, test2.exe.manifest, ...
Change the given manifest file's name according to the exe you create. It should work. It works for this project.
Another thing, please refer to this Article also. It says how to get this in the VB6 IDE. download the manifest file for VB6 and copy it to the folder where VB6.exe is located.In my machine its in "C:\Program Files\Microsoft Visual Studio\VB98" folder. then it works in the project also. its a cool stuff. I should add it to my project also.
PS : Since I didnt want his in all y project, I did something to have two vb6 IDE's. I renamed manifest file as VB2.exe.manifest and made a copy of vb6.exe as vb62.exe.
So I have two IDEs, one with normal VB6 Look and Feel and aone with XP Style look and feel.
Cheers.
hi zeezee,
u attached only the project file, how bout the forms
Re: Show tooltips text directly when caps lock is on
Originally Posted by ashly
hi zeezee,
u attached only the project file, how bout the forms
, this is the project file for the demo in that article. You got that demo right ???
get the demo, extract it, replace this project file with the one in there. then it should work.
Or
Open the .VBP file with Notepad, then remove the line that says "Related Documents" (i think its the 4th or 5th) line.
Make sure you register that dll file SSubTmr.dll. I ll upload the project with the changed project file andd the Dll is also in that file.there is a bat file , run it and it will register the dll.
But I suggest that you copy this DLL to system32 directory and open it with regsvr32.exe (its in system32 too) if you are goin to use this for your project.
for the IDE, the manifest is in the VB6_IDE_Manifest.zip
Cheers
Last edited by zeezee; Aug 6th, 2007 at 12:16 AM.
Reason: add the attachement
Re: Show tooltips text directly when caps lock is on
Here's another program (that doesn't require an API call) that will turn Tool Tips On & Off by toggling the Caps Lock key. This program beats my first posting all to hell, as that code could be tricked and did not know if Caps Lock was on or off at start up. This one seems to work flawlessly and knows if the Caps Lock is on or off, at all times, including at start up! Please pardon my excessive remming as, I'm a novice and 61+ years old, and need as much remming as possible.
The program requires two text boxes. All design time properties are default
Have fun.
CDRIVE
Code:
'This program demonstrates the use of the SendKeys Statement to test the state of the
'Caps Lock key. The value returned from Text2 is used to turn Text1 Tool Tips on and
'off by toggling the Caps Lock key. The Form1 Load event also tests the status of the
'Caps Lock key immediately upon program start up.
Private Sub Form_Load()
Form1.Caption = "If Caps Lock On Then Tool Tips On!"
Show
Form1.KeyPreview = True
Text1 = ""
Text2 = ""
Text2.SetFocus
SendKeys "a" 'Send a lower case 'a' to Text2 to test for CapsLock
End Sub 'status at startup.
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Print " A KeyDown Event accured!" 'Used for testing only
If KeyCode = vbKeyCapital Then
Text2.Visible = True 'Reset visible property so Text2 can SetFocus
Text2.SetFocus
Text2 = "" 'Clear Text2 on each Caps Lock press
SendKeys "a" 'Put a lower case 'a' in Text2 to be tested
' Else 'by the KeyUp event.
' If KeyCode <> vbKeyCapital Then 'This 'Else If' block was only required prior
' Text1.SetFocus 'to adding the Text2.Visible property to the
' End If 'the program. Text1 automatically receives the
End If 'focus when Text2.Visible = False.
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Print " A KeyUp Event accured!" 'Used for testing only
Text2.Visible = False
If Text2 = Chr(65) Then 'If Text2 returns an upper case 'a'
Text1.ToolTipText = "Tool Tips Are On!" '(Chr(65))then turn Tool Tips ON.
ElseIf Text2 = Chr(97) Then 'If Text2 returns a lower case 'a'
Text1.ToolTipText = "" '(Chr(97))then turn Tool Tips OFF.
End If
End Sub