Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Components
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB Components Issues specific to components in VB.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Components section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 31st, 2004, 02:19 AM
Authorized User
 
Join Date: Aug 2003
Location: Kolkata, West Bengal, India.
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Kaustav Send a message via Yahoo to Kaustav
Default Menu Help in statusbar at mousemove over Menu item

How can i display help in status bar when the mouse moves over or highlights a specific menu item in my application.
That is,
if i click on" File" menu and move my mouse over "Save" command or menu item a help string "Saves the open document" is displayed in statusbar1.panels(1).text
If this is possible with API also plz provide your help.Urgent!!!!!!!!!

Bye

------------------
Kaustav
__________________
------------------
Kaustav
Reply With Quote
  #2 (permalink)  
Old September 14th, 2005, 09:28 AM
Registered User
 
Join Date: Sep 2005
Location: York, PA, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

  I know that this is an old post, but I thought I would give the solution since I just came accross this problem myself.  Hope this helps .

Paste this code into the Load procedure for the form (create a status bar and name it ‘sbStatusBar’):

    ' Set up the status bar.
    ' Make 4 panels.
    Do While sbStatusBar.Panels.Count < 4
        sbStatusBar.Panels.Add
    Loop
    sbStatusBar.Panels.Item(1).Alignment = sbrLeft
    sbStatusBar.Panels.Item(2).Alignment = sbrCenter
    sbStatusBar.Panels.Item(4).Alignment = sbrCenter
    sbStatusBar.Panels.Item(1).Bevel = sbrInset
    sbStatusBar.Panels.Item(2).Bevel = sbrNoBevel
    sbStatusBar.Panels.Item(3).Bevel = sbrInset
    sbStatusBar.Panels.Item(4).Bevel = sbrInset
    sbStatusBar.Panels.Item(1).MinWidth = 5000
    If MDIMain.ScaleWidth - sbStatusBar.Panels.Item(1).Width - sbStatusBar.Panels.Item(3).Width - sbStatusBar.Panels.Item(4).Width > 30 Then
        sbStatusBar.Panels.Item(2).MinWidth = MDIMain.ScaleWidth - sbStatusBar.Panels.Item(1).Width - sbStatusBar.Panels.Item(3).Width - sbStatusBar.Panels.Item(4).Width
    Else
        sbStatusBar.Panels.Item(2).MinWidth = 30
    End If
    sbStatusBar.Panels.Item(1).Style = sbrText
    sbStatusBar.Panels.Item(3).Style = sbrDate
    sbStatusBar.Panels.Item(4).Style = sbrTime
    ' Hook all messages.
    lOldMDIMainProcAddr = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc) ' Hook window sub-classing.

Paste this code into the Resize procedure for the form:

    If MDIMain.ScaleWidth - sbStatusBar.Panels.Item(1).Width - sbStatusBar.Panels.Item(3).Width - sbStatusBar.Panels.Item(4).Width > 30 Then
        sbStatusBar.Panels.Item(2).MinWidth = MDIMain.ScaleWidth - sbStatusBar.Panels.Item(1).Width - sbStatusBar.Panels.Item(3).Width - sbStatusBar.Panels.Item(4).Width
    Else
        sbStatusBar.Panels.Item(2).MinWidth = 30
    End If

Paste this code into the Unload procedure for the form:

    Call SetWindowLong(hWnd, GWL_WNDPROC, lOldMDIMainProcAddr) ' Unhook window sub-classing.

Paste this code in a code module:
Option Explicit

Public lOldMDIMainProcAddr As Long

Public Const MF_POPUP = &H10&
Public Const WM_MENUSELECT = &H11F

Public Declare Function SendMessage Lib "user32" _
 Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
 wParam As Any, lParam As Any) As Long

' Windows API Call for catching messages
Public Declare Function SetWindowLong Lib "user32" _
    Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
    ByVal dwNewLong As Long) As Long

' Windows API call for calling window procedures
Public Declare Function CallWindowProc Lib "user32" _
    Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, _
    ByVal hWnd As Long, ByVal Msg As Long, _
    ByVal wParam As Long, ByVal lParam As Long) As Long


Public Function WindowProc(ByVal hWnd As Long, ByVal iMsg As Long, _
    ByVal wParam As Long, ByVal lParam As Long) As Long
    Dim MenuItemStr As String * 128
    Dim MenuHandle As Integer
    Select Case iMsg
    Case WM_MENUSELECT
        ' This occurs when the menu is being closed
        If lParam = 0 Then Exit Function
        ' Get the low word from wParam.  This contains the command ID or position of the menu entry.
        MenuHandle = GetLowWord(wParam)

        ' If the highlighted menu is the top of a poup menu, pass menu item by position.
        If (GetHighWord(wParam) And MF_POPUP) = MF_POPUP Then
            ' If the MF_POPUP bit was set in the high word, the menu item has a
            ' sub-menu attached to it.  The position in MenuHandle will be useless.
            MDIMain.sbStatusBar.Panels.Item(1).Text = ""
        Else ' Otherwise, MenuHandle will contain a unique ID of the menu item.
            Select Case MenuHandle
                Case 2
                    MenuItemStr = "Exit the program..."
                Case 3
                    MenuItemStr = "Print the selected item..."
                ' Use this code to see the ID of all menu items, then add a Case
                ' clause to set MenuItemStr for each instance.
                Case Else
                    MenuItemStr = MenuHandle
            End Select
        MDIMain.sbStatusBar.Panels(1).Text = MenuItemStr
        End If
        WindowProc = CallWindowProc(lOldMDIMainProcAddr, hWnd, iMsg, wParam, lParam)
    Case Else
        ' Pass all other messages.
        WindowProc = CallWindowProc(lOldMDIMainProcAddr, hWnd, iMsg, wParam, lParam)
    End Select
End Function

Public Function GetLowWord(Word As Long)
   GetLowWord = CInt("&H" & Right$(Hex$(Word), 4))
End Function

Public Function GetHighWord(Word As Long)
    GetHighWord = CInt("&H" & Left$(Hex$(Word), 4))
End Function
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
View IE Favorites in a Menu Item. jpool Visual Studio 2005 0 October 3rd, 2008 11:51 AM
Menu Item stays greyed out bnsteel BOOK: Beginning Mac OS X Programming 1 January 10th, 2008 01:18 PM
right click on a menu item chuckcottle C++ Programming 3 May 14th, 2007 10:34 AM
cannot add a new item to this menu ... paulmarshall General .NET 0 April 18th, 2007 03:03 PM
how create menubar, menu, menu item in xsl vijayanmsc XSLT 1 June 5th, 2006 06:43 AM



All times are GMT -4. The time now is 10:32 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.