Results 1 to 16 of 16

Thread: Show tooltips text directly when caps lock is on

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    187

    Question Show tooltips text directly when caps lock is on

    hello everyone,

    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.

    any idea or example can share to me?

    thanks

  2. #2

  3. #3

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    187

    Re: Show tooltips text directly when caps lock is on

    i get the code on how to check whether a Caps Lock is on or not, but the proble i facing now is how to show a tooltips text automatically...

    as for an example on what i want to do, you may try it when logging in a WinXP

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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.

  6. #6
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    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

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Show tooltips text directly when caps lock is on

    Quote 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.

  8. #8
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Show tooltips text directly when caps lock is on

    Thanks for that info. It clears that up for me.

    I just want to say that the activity on this forum is absolutely outstanding!!!

    CDRIVE

  9. #9
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Show tooltips text directly when caps lock is on

    Cant we use the Baloon Tips like in XP ???
    It looks nicer..
    I havent used it since I didnt want them, TRy THIS article.

    and THIS also.
    NOTE it has a demo project to download too..


    Another one to show popup window.


    Cheers !!!
    Last edited by zeezee; Aug 4th, 2007 at 02:17 PM. Reason: wrong urls

  10. #10
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: Show tooltips text directly when caps lock is on

    if you are planning on making the change to 2005 anytime soon, it comes with a tooltip control that also supports balloons.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    187

    Re: Show tooltips text directly when caps lock is on

    anyone who tried the article posted by zeezee, please shared out opinions here.

    i tried, but got errors on the downloaded project

  12. #12
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Show tooltips text directly when caps lock is on

    Quote 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


  13. #13
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    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.
    Attached Files Attached Files
    Last edited by zeezee; Aug 5th, 2007 at 11:01 PM. Reason: Additions

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    187

    Re: Show tooltips text directly when caps lock is on

    Quote 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

  15. #15
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Show tooltips text directly when caps lock is on

    Quote 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
    Attached Files Attached Files
    Last edited by zeezee; Aug 6th, 2007 at 12:16 AM. Reason: add the attachement

  16. #16
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    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
    Last edited by CDRIVE; Mar 7th, 2010 at 03:53 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width