Solved

Coolbar

Posted on 1998-07-02
6
257 Views
Last Modified: 2010-05-03
I would just like to ask if the coolbar could be implemented in an MDI form.  Whenever I use the coolbar in an
MDI form, it returns an invalid page fault error.  I believe the error's in

Public Sub SubClass(hwnd As Long)
    NextProcs = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindowProc)  
    'suspected error to be in third parameter
End Sub

the call to the function WindowProc.  Is it possible to fix this problem?
0
Comment
Question by:wsanchez
  • 3
  • 3
6 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 70 total points
ID: 1464788
Where is WindowProc located?  It MUST be in a BAS file.

also, Coolbar..d o you mean like outlook, or just a flat toolbar?  If you mean a flat toolbar, I can do that without subclassing.

Anthony
0
 

Author Comment

by:wsanchez
ID: 1464789
Coolbar as in flat toolbars.  Actually I have downloaded it from the net.  It consists of the CRebar(Rebar.cls) class module and the RebarSubClass(Rebarsubclass.bas) module.
Public Sub SubClass(hwnd As Long) is located in the MDI form while WindowProc is located in the Rebarsubclass.bas module.

Could you show me how to implement it in an MDI form if possible?
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1464790
Seems like a lot of work.  I have a wrapper function that if you pass it the comctl32 toolbar, SP3, it will make it flat with a flag.  Here it is:

Private Const WM_USER = &H400
Private Const TB_SETSTYLE = WM_USER + 56
Private Const TB_GETSTYLE = WM_USER + 57
Private Const TBSTYLE_FLAT = &H800

Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Public Sub SetToolbarStyle(tbr As Object, bFlat As Boolean)
    Dim lStyle   As Long
    Dim lToolbar As Long
    Dim lRes     As Long
   
    If UCase$(TypeName(tbr)) = "TOOLBAR" Then
        'Make it flat

        'get the handle of the toolbar
        lToolbar = FindWindowEx(tbr.hwnd, 0&, "ToolbarWindow32", vbNullString)

        'retrieve the toolbar styles
        lStyle = SendMessageLong(lToolbar, TB_GETSTYLE, 0&, 0&)

        'Set the new lStyle flag
        If bFlat Then
            lStyle = lStyle Or TBSTYLE_FLAT
        Else
            lStyle = lStyle Xor TBSTYLE_FLAT
        End If

        'apply the new lStyle to the toolbar
        lRes = SendMessageLong(lToolbar, TB_SETSTYLE, 0, lStyle)
        tbr.Refresh
    End If
End Sub

0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:wsanchez
ID: 1464791
anthonyc, I still have to try this out but I would like to make it clear that the Coolbar works with a non-MDI form.  Also, how do I call the procedure you gave and where do I put it (just to be sure).
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1464792
Wsanchez,

My function will work with any form that has a toolbar with it.  You can place the function in a BAS file, and then  just call it.  It doesn't have to be in a BAS file, but if it is, then everyone can use it.

One thing about MDI Forms, the HWND of the MDIFORM is NOT the HWND of the client area where the toolbar resides. MDI Forms consist of a few windows.
0
 

Author Comment

by:wsanchez
ID: 1464793
anthonyc.  Thanks for the code.  It works and it's much shorter.  Do you have any code that makes the toolbar movable.  Anyway, here are the points for the flat toolbar.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
message box in access 4 51
Advice in Xamarin 21 96
Formula problem with Excel attachment 6 39
transition to visual .net from vb6 5 37
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question