?
Solved

Coolbar

Posted on 1998-07-02
6
Medium Priority
?
260 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 280 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

752 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