Solved

Coolbar

Posted on 1998-07-02
6
252 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now