AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

How to implement "What's this?" Help

Under Windows 95 and Windows NT 3.51, it is possible to right-click on items and get the "What's This?" window to appear. To set this up in Visual Basic, you need to use a pop-up menu.

Example

  1. Start Visual Basic 4.0 or, if it is already running, click New Project on the File menu.
  2. Set the WhatsThisHelp and WhatsThisButton properties for Form1 to TRUE.
  3. Add the following code to reference the Hotspot Editor help file to the Form_Load procedure:Private Sub Form_Load()
    ' This should point to the hc directory 
    'under the VB4 directory 
    App.HelpFile = "c:\vb\hc\shed.hlp"
    End Sub       

  4. Add two menu items to Form1 using the following as a guide:
    Menu Property Value
    ----------------------------------------------------
    WhatsThis Caption WhatsThis
    WhatsThis Name mnuWhatsThis
    WhatsThis Visible False
    
    
    What's This? Caption What's This?
    What's This? Name mnuWhatsThisHelp
     
  5. Indent "What's This?" to make it a sub-menu of WhatsThis by pressing the right-arrow button on the Menu Editor.
  6. Add the following code to the General Declarations section of Form1: Public ThisControl as control

  7. Add the following code to the mnuWhatsThisHelp_Click procedure:       Private Sub mnuWhatsThisHelp_Click()
              ThisControl.ShowWhatsThis
           End Sub
              

  8. Add a Command Button control to the form and set the following Properties:WhatsThisHelpID = 1
    HelpContextID = 5      

  9. Add following code to the Command1_MouseUp event:Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, _
    X As Single, Y As Single)
    If Button = vbRightButton Then
        Set ThisControl = Command1
        PopupMenu mnuWhatsThis 
    End If 
    Set ThisControl = Nothing 
    End Sub       

  10. Run the application. Right-click on the Command button and then left-Click on the "What's This?" popup to bring up 
    the Help file.      

Source: Microsoft Knowledge Base

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/