English
Forum

MDI application

 

Detlef
Jagolski
Hi,

question on our Experten:

an application commit The message WM_MDISETMENU, around the Menu the MDI-Rahmenfensters (Multidokumentschnittstelle), the Pop-up-Menu the Fensters or both to exchange.
is it possible the Menu as Owner Draw festzulegen. All other items are Owner Draw.
I have yet no API function found.

...and if so, how does that...
Greeting

Detlef
CompileMarkSeparation
Proc MDIChildProc

    Parameters Wnd&, Message&, wParam&, lParam&

    If Message& = ~WM_CREATE

    EndIf

    If Message& = ~WM_MDIACTIVATE

        If wParam& = &FALSE

            hChildMenu& = ~GetSubMenu(hMenu&,1)
            hNewChildMenu& =                 MakeLong(hChildMenu&,~GetSubMenu(~GetMenu(Wnd&),1))
            SendMessage(hWndClient&,~WM_MDISETMENU,0,hNewChildMenu&)
            ~DrawMenuBar(hNewChildMenu&)
            ………………………………………………..

        EndIf

    ElseIf Message& = ~WM_CLOSE

        SendMessage(hWndClient&,~WM_MDIDESTROY,Wnd&,0)
        cc& = cc& - 1

    Else

        Return ~DefMDIChildProc(Wnd&, Message&, wParam&, lParam&)

    EndIf

ENDPROC

 
XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11
08/24/05  
 



I faith I have The question not really understood.

salvo, iF.

PS: Please Codes with the
CompileMarkSeparation comprise.

salvo, iF.
 
08/24/05  
 




Detlef
Jagolski
Hello IF,

So I would like any items as Owner Draw with Icon present, not the standard Menu. there but the Menu for MDI Window of system prepares becomes, can I these items not Change.

Greeting

Detlef
 
XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11
08/24/05  
 



OK - the have I understood.

question1: mandatory it same OD his - because nice Icons get You too without OD into items...
question2: have You already one OD-Menu develops?

salvo, iF.
 
08/24/05  
 




Detlef
Jagolski
Hello iF,

question1: the should it already his.
question2: OD-Menu have I develops.
CompileMarkSeparation
Struct MenuItemInfo = cbSize&, fMask&, fType&, fState&, wID&, hSubMenu&, hbmpChecked&, hbmpUnchecked&, dwItemData&, dwTypeData&, cch&
Struct MeasureItemStruct = ~MEASUREITEMSTRUCT
Struct DrawItemStruct = ~DRAWITEMSTRUCT
Struct Rect = ~RECT
Struct Size = ~SIZE
Struct MenuData = MenuText$(255), IconIndex&, MenuPopUp&, MenuFont&, fType&
Struct ICONINFO = ~ICONINFO
Struct BITMAP = ~BITMAP
Declare MenuItemInfo#
Declare lpmis#
Declare lpdis#
Declare Rect#
Declare TRect#
Declare GRect#
Declare Size#
Declare MenuData#[150]
Declare MyMenuData#
Declare MenuText#
Declare IconName$
Declare hImagelist&
Declare hImagelist2&
Declare CheckedImage&
Declare hIcon&
Declare hIconGray&
Declare hDll&
Declare hBitmapDll&
Declare BitmapFile$
Declare Iczz%
Declare Iccnt%
Declare Menu%
Declare MenuDC&
Declare MenuIcon&
Declare dwCheckXY&
Declare nTextWidth&
Declare nTextHeight&
Declare nImageWidth&
Declare nImageHeight&
Declare wCheckX&
Declare Bitmap$
Declare XMbgBMP&
Declare XMBrush&
Declare ItemText$
Declare MenuPen&
Declare MenuFont&
Declare OldMenuPen&
Declare hOldFont&
Declare LeftItext$
Declare RightItext$
Declare Color_IconBack&
Declare Color_Line&
Declare Color_Selected&
Declare Color_FrameRect&
Declare S#
Declare ToolBar&
Declare ToolinfoButton#
Declare t#
Declare Text#
Declare TipControl&
Dim MenuItemInfo#,MenuItemInfo
Dim lpmis#,24
Dim lpdis#,DrawItemStruct
Dim Rect#,Rect
Dim TRect#,Rect
Dim GRect#,Rect
Dim Size#,Size
Dim MenuData#[],MenuData
Dim MyMenuData#,MenuData
Dim MenuText#,255
Menu% = 0

Proc CreateGrayscaleIcon

    Parameters hIcon&
    Declare IconInfo#
    Declare IconInfo2#
    Declare Bitmap#
    Declare bRetValue&
    Declare hMainDC&
    Declare hMemDC1&
    Declare hMemDC2&
    Declare dwWidth&
    Declare dwHeight&
    Declare hOldBmp1&
    Declare hOldBmp2&
    Declare dwLoopY&
    Declare dwLoopX&
    Declare crPixel&
    Declare byNewPixel&
    Declare hGrayIcon&
    Dim IconInfo#,ICONINFO
    Dim IconInfo2#,ICONINFO
    Dim Bitmap#,BITMAP
    bRetValue& = ~GetIconInfo(hIcon&,IconInfo#)
    Case bRetValue& = 0: Return 0
    hMainDC& = ~GetDC(0)
    hMemDC1& = ~CreateCompatibleDC(hMainDC&)
    hMemDC2& = ~CreateCompatibleDC(hMainDC&)
    ~GetObject(IconInfo#.hbmColor&, SizeOf(Bitmap#), Bitmap#)
    dwWidth&  = IconInfo#.xHotspot& * 2
    dwHeight& = IconInfo#.yHotspot& * 2
    IconInfo2#.hbmColor& = ~CreateBitmap(dwWidth&, dwHeight&, Bitmap#.bmPlanes%,Bitmap#.bmBitsPixel%,0)
    hOldBmp1& = ~SelectObject(hMemDC1&, IconInfo#.hbmColor&)
    hOldBmp2& = ~SelectObject(hMemDC2&, IconInfo2#.hbmColor&)
    ~BitBlt(hMemDC2&,0,0,dwWidth&,dwHeight&,hMemDC1&,0,0,~SRCCOPY)
    crPixel& = 0
    byNewPixel& = 0
    dwLoopY& = 0

    Whileloop dwHeight&

        dwLoopX& = 0

        Whileloop dwWidth&

            crPixel& = ~GetPixel(hMemDC1&,dwLoopX&,dwLoopY&)
            byNewPixel& = (GetRValue(crPixel&) + GetGValue(crPixel&) + GetBValue(crPixel&)) / 3
            ~SetPixel(hMemDC2&,dwLoopX&,dwLoopY&,RGB(byNewPixel&,byNewPixel&,byNewPixel&))
            Inc dwLoopX&

        EndWhile

        Inc dwLoopY&

    EndWhile

    ~SelectObject(hMemDC1&, hOldBmp1&)
    ~SelectObject(hMemDC2&, hOldBmp2&)
    IconInfo2#.hbmMask& = IconInfo#.hbmMask&
    IconInfo2#.fIcon& = 1
    hGrayIcon& = ~CreateIconIndirect(IconInfo2#)
    ~DeleteObject(IconInfo2#.hbmColor&)
    ~DeleteObject(IconInfo2#.hbmMask&)
    ~DeleteObject(IconInfo#.hbmColor&)
    ~DeleteObject(IconInfo#.hbmMask&)
    ~DeleteDC(hMemDC1&)
    ~DeleteDC(hMemDC2&)
    ~ReleaseDC(0,hMainDC&)
    Dispose IconInfo#
    Dispose IconInfo2#
    Dispose Bitmap#
    Return hGrayIcon&

EndProc

Proc MeasureItem

    MenuDC& = ~GetDC(Wnd&)
    lpmis# = lParam&

    If Long(lpmis#,0) = ~ODT_MENU

        MyMenuData#             = Long(lParam&,20)
        dwCheckXY&              = ~GetMenuCheckMarkDimensions()
        nImageWidth&            = HiWord(dwCheckXY&)
        nImageHeight&           = LoWord(dwCheckXY&)
        wCheckX&                = HiWord(dwCheckXY&)+ 10
        ItemText$               = MyMenuData#.MenuText$
        MenuFont&               = MyMenuData#.MenuFont&
        hOldFont&               = ~SelectObject(MenuDC&,MenuFont&)
        ~GetTextExtentPoint32(MenuDC&,Addr(ItemText$),Len(ItemText$),Size#)

        If MyMenuData#.fType& = ~MFT_SEPARATOR

            Case Int(Val($WinVer)) = 4: Long lpmis#,12 = Size#.cx& + wCheckX& + nImageWidth& + 45
            Case Int(Val($WinVer)) = 4: Long lpmis#,16 = Size#.cy& + 10
            Case Int(Val($WinVer)) = 5: Long lpmis#,12 = Size#.cx&
            Case Int(Val($WinVer)) = 5: Long lpmis#,16 = Size#.cy& - 5

        Else

            Long lpmis#,12  = Size#.cx& + wCheckX& + nImageWidth& + 45
            Long lpmis#,16 = Size#.cy& + 10
            ~SelectObject(%HDC,hOldFont&)

        EndIf

        Return 1

    EndIf

EndProc

Proc DrawItem

    lpdis# = lParam&

    If Long(lpdis#,0) = ~ODT_MENU

        MyMenuData#     = Long(lpdis#,44)
        nTextWidth&     = wCheckX& + Long(lpdis#,28)
        nTextHeight&    = Long(lpdis#,32)
        MenuIcon&       = MyMenuData#.IconIndex&
        ItemText$       = MyMenuData#.MenuText$
        MenuFont&       = MyMenuData#.MenuFont&
        Long Rect#,0    = Long(lpdis#,28)
        Long Rect#,4    = Long(lpdis#,32)
        Long Rect#,8    = Long(lpdis#,36)
        Long Rect#,12   = Long(lpdis#,40)
        Long GRect#,0   = Long(lpdis#,28)
        Long GRect#,4   = Long(lpdis#,32)
        Long GRect#,8   = Long(lpdis#,36) - Long(Rect#,8) + 25
        Long GRect#,12  = Long(lpdis#,40)
        Long TRect#,0   = Long(lpdis#,28) + wCheckX& + 8
        Long TRect#,4   = Long(lpdis#,32) + 4
        Long TRect#,8   = Long(lpdis#,36) - 1
        Long TRect#,12  = Long(lpdis#,40)
        ~FillRect(lpdis#.HDC&,GRect#,~CreateSolidBrush(Color_IconBack&))

        If XMBrush&

            ~SelectObject(lpdis#.HDC&,XMBrush&)
            ~PatBlt(lpdis#.hdc&,nImageWidth& + 12,Long(lpdis#,32),Long(lpdis#,36),Long(lpdis#,40) - Long(lpdis#,32),~PATCOPY)

        EndIf

        If MyMenuData#.fType& = ~MFT_SEPARATOR

            MenuPen& = ~CreatePen(~PS_SOLID,1,Color_Line&)
            OldMenuPen& = ~SelectObject(lpdis#.HDC&,MenuPen&)
            ~MoveToEx(lpdis#.HDC&,Long(TRect#,0),Long(TRect#,4),0)
            ~LineTo(lpdis#.HDC&,Long(TRect#,8),Long(TRect#,4))
            ~SelectObject(lpdis#.HDC&,OldMenuPen&)

        EndIf

        If Long(lParam&,16) & ~ODS_GRAYED

            ~ImageList_Draw(hImagelist2&,MenuIcon&,lpdis#.HDC&,Long(lpdis#,28)+4,Long(lpdis#,32)+4,~ILD_TRANSPARENT)
            ~SetTextColor(lpdis#.HDC&,~GetSysColor(~COLOR_GRAYTEXT))

        Else

            If Long(lParam&,16) & ~ODS_SELECTED

                ~FillRect(lpdis#.HDC&,Rect#,~CreateSolidBrush(Color_Selected&))
                ~FrameRect(lpdis#.HDC&,Rect#,~CreateSolidBrush(Color_FrameRect&))
                ~SetBkColor(lpdis#.HDC&,RGB(128,128,255))
                ~ImageList_Draw(hImagelist&,MenuIcon&,lpdis#.HDC&,Long(lpdis#,28)+4,Long(lpdis#,32)+4,~ILD_TRANSPARENT)

            Else

                If XMBrush&

                    ~SelectObject(lpdis#.HDC&,XMBrush&)
                    ~PatBlt(lpdis#.hdc&,nImageWidth& + 12,Long(lpdis#,32),Long(lpdis#,36),Long(lpdis#,40) - Long(lpdis#,32),~PATCOPY)

                Else

                    ~FillRect(lpdis#.HDC&,Rect#,~GetSysColorBrush(~COLOR_MENU))
                    ~FillRect(lpdis#.HDC&,GRect#,~CreateSolidBrush(Color_IconBack&))

                EndIf

                ~ImageList_Draw(hImagelist&,MenuIcon&,lpdis#.HDC&,Long(lpdis#,28)+4,Long(lpdis#,32)+4,~ILD_TRANSPARENT)

            EndIf

        EndIf

        If Long(lParam&,16) & ~ODS_DISABLED

            ~ImageList_Draw(hImagelist2&,MenuIcon&,lpdis#.HDC&,Long(lpdis#,28)+4,Long(lpdis#,32)+4,~ILD_TRANSPARENT)
            ~SetTextColor(lpdis#.HDC&,~GetSysColor(~COLOR_GRAYTEXT))

        Else

            ~ImageList_Draw(hImagelist&,MenuIcon&,lpdis#.HDC&,Long(lpdis#,28)+4,Long(lpdis#,32)+4,~ILD_TRANSPARENT)
            ~SetTextColor(lpdis#.HDC&,~GetSysColor(~COLOR_MENUTEXT))

        EndIf

        If Long(lParam&,16) & ~ODS_CHECKED

            ~ImageList_Draw(hImagelist&,CheckedImage&,lpdis#.HDC&,Long(lpdis#,28)+4,Long(lpdis#,32)+4,~ILD_TRANSPARENT)

        EndIf

        hOldFont& = ~SelectObject(lpdis#.HDC&,MenuFont&)
        ~SetBkMode(lpdis#.HDC&,~TRANSPARENT)

        IfNot MyMenuData#.fType& = ~MFT_SEPARATOR

            LeftItext$ = Substr$(Itemtext$,1,"	") + "   "
            RightItext$ = Trim$(Substr$(Itemtext$,2,"	")) + "    "
            ~DrawText(lpdis#.HDC&,Addr(LeftItext$),Len(LeftItext$),TRect#,~DT_LEFT)

            IfNot RightItext$ = "  "

                ~DrawText(lpdis#.HDC&,Addr(RightItext$),Len(RightItext$),TRect#,~DT_RIGHT)

            EndIf

            ~SelectObject(lpdis#.HDC&,hOldFont&)

        EndIf

    EndIf

EndProc

Proc CreateImageList

    Parameters IconFile$
    IconFile$ = Upper$(IconFile$)
    hDll&     = UseDll(IconFile$)
    Iccnt%    = IconCount(IconFile$) + 1
    hImagelist& = ~ImageList_Create(16,16,~ILC_COLOR32 | ~ILC_MASK,500,500)
    hImagelist2& = ~ImageList_Create(16,16,~ILC_COLOR32 | ~ILC_MASK,500,500)
    Clear Iczz%

    WhileNot Iczz% = Iccnt%

        IconName$ = "#" + Trim$(Str$(Iczz%))
        hIcon& = ~LoadIcon(hDll&,Addr(IconName$))
        ~ImageList_AddIcon(hImagelist&,hIcon&)
        CreateGrayscaleIcon hIcon&
        hIconGray& = @&(0)
        ~ImageList_AddIcon(hImagelist2&,hIconGray&)
        Inc Iczz%

    Wend

    FreeDLL hDll&

EndProc

Proc ChangeMenuItem

    Parameters hMenu&, pMenu&, Index&, Font&

    with MenuItemInfo#

        .cbSize&          = SizeOf(MenuItemInfo#)
        .fMask&           = ~MIIM_DATA | ~MIIM_TYPE | ~MIIM_ID
        .dwTypeData&      = MenuText#
        .cch&             = SizeOf(MenuText#)

    endwith

    ~GetMenuItemInfo(hMenu&,pMenu&,~MF_BYPOSITION,MenuItemInfo#)

    with MenuData#[Menu%]

        .MenuText$        = String$(MenuText#,0)
        .IconIndex&       = Index&
        .MenuPopUp&       = ~GetSubMenu(hMenu&,pMenu&)
        .MenuFont&        = Font&
        .fType&           = MenuItemInfo#.fType&

    endwith

    If MenuItemInfo#.fType& = ~MFT_SEPARATOR

        with MenuItemInfo#

            .fType&           = ~MFT_OWNERDRAW
            .fMask&           = ~MIIM_DATA | ~MIIM_TYPE
            .dwItemData&      = MenuData#[Menu%]

        endwith

        ~SetMenuItemInfo(hMenu&,pMenu&,~MF_BYPOSITION,MenuItemInfo#)

    Else

        with MenuItemInfo#

            .fType&           = ~MFT_OWNERDRAW
            .fMask&           = ~MIIM_DATA | ~MIIM_TYPE
            .dwItemData&      = MenuData#[Menu%]
            .dwTypeData&      = MenuText#

        endwith

        ~SetMenuItemInfo(hMenu&,pMenu&,~MF_BYPOSITION,MenuItemInfo#)

    EndIf

    Inc Menu%

EndProc

Proc SetCheckedImage

    Parameters Checked&
    CheckedImage& = Checked&

EndProc

Proc SetMenuColors

    Parameters IconBackColor&, LineColor&, SelectedColor&, FrameRectColor&
    Color_IconBack&  = IconBackColor&
    Color_Line&      = LineColor&
    Color_Selected&  = SelectedColor&
    Color_FrameRect& = FrameRectColor&

EndProc

Proc SetMenuStandardColors

    Color_IconBack&  = RGB(212,208,200)
    Color_Line&      = RGB(212,208,200)
    Color_Selected&  = RGB(128,128,255)
    Color_FrameRect& = RGB(0,0,255)

EndProc

Proc SetMenuBitmap

    Parameters BitmapFile$, Bitmap$
    hBitmapDll&     = UseDll(BitmapFile$)

    If Bitmap$ <> ""

        Case XMbgBmp& : ~DeleteObject(XMbgBmp&)
        Case XMBrush& : ~DeleteObject(XMBrush&)
        XMbgBMP& = Create("hPic",hBitmapDll&,Bitmap$)
        XMBrush& = ~CreatePatternBrush(XMbgBmp&)
        FreeDLL hBitmapDll&

    EndIf

EndProc

Proc DisposeXPMenu

    Dispose MenuItemInfo#
    Dispose MenuText#
    Dispose MenuData#[]
    Dispose MyMenuData#
    Dispose lpdis#
    Dispose lpmis#
    Dispose Rect#
    Dispose GRect#
    Dispose TRect#
    Dispose Size#
    ~ImageList_Destroy(hImagelist&)
    ~ImageList_Destroy(hImagelist2&)
    ~DeleteDC(MenuDC&)
    ~DeleteObject(MenuPen&)
    ~DeleteObject(OldMenuPen&)

ENDPROC

 
XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11
08/24/05  
 



Lol - now has it Click by me made.

i know of course wonach You seek - You want so How I it understood have your ODMenü as _default settle - quasi a Handletausch manage - whether this so virtual is white I unfortunately not , but...

usually ought to one Yes the Menu refreshen after The Message ankommt - use still simply these Message as Indikator for the You, the Menu self austauscht...
 
08/25/05  
 




Detlef
Jagolski
Hi,

have yet no Solution, need yet a Tipp.

good night
 
XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11
08/25/05  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.424 Views

Untitledvor 0 min.
Normann Strübli10/08/20
Ernst01/11/15
Edmund Coenen05/28/13
iF05/07/13

Themeninformationen

this Topic has 2 subscriber:

Detlef Jagolski (4x)
iF (3x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie