Español
Foro

MDI Anwendung

 

Detlef
Jagolski
¡Hola,

Cuestión a unsere Experten:

Un Anwendung übergibt el Botschaft WM_MDISETMENU, en el Menü des MDI-Rahmenfensters (Multidokumentschnittstelle), el Pop-up-Menü la ventana oder beide auszutauschen.
¿Es posible el Menü como Owner Draw festzulegen. Todos los demás Menüpunkte son Owner Draw.
Yo habe bisher no API Función gefunden.

...y si sí, como va el...
Saludo

Detlef
KompilierenMarcaSeparación
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
24.08.2005  
 



Yo glaube Yo el Cuestión no wirklich verstanden.

Salve, IF.

PS: Bitte Codes con el
KompilierenMarcaSeparación umfassen.

Salve, IF.
 
24.08.2005  
 




Detlef
Jagolski
¡Hola IF,

Also Yo möchte todos Menüpunkte como Owner Draw con Icon darstellen, no el Standard Menü. Como aber el Menü para el MDI Ventana vom Sistema erstellt se, kann Yo esta Menüpunkte no ändern.

Saludo

Detlef
 
XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11
24.08.2005  
 



Ok - el Yo verstanden.

Cuestión1: Muß lo igual OD ser - porque schöne Icons bekommst Usted auch sin OD en el Menüpunkte...
Cuestión2: Hast Usted ya una OD-Menü entwickelt?

Salve, IF.
 
24.08.2005  
 




Detlef
Jagolski
Hola si,

Cuestión1: Das se lo ya ser.
Cuestión2: OD-Menu Yo entwickelt.
KompilierenMarcaSeparación
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
24.08.2005  
 



Lol - ahora ha lo Clic en me gemacht.

Yo weiß zwar wonach Usted suchst - Usted möchtest como Yo verstanden habe Su ODMenü como _default conjunto - quasi una Handletausch durchführen - si dies así pensamiento es weiß Yo por desgracia, no , aber...

Normalerweise debería uno sí el Menü refreshen después de el Message ankommt - nutze doch simplemente esta Message como Indikator dafür el Usted el Menü incluso austauscht...
 
25.08.2005  
 




Detlef
Jagolski
¡Hola,

habe todavía no Solución, brauche todavía una Tipp.

Gute Nacht
 
XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11
25.08.2005  
 



Respuesta


Título del Tema, max. 100 Signo.
 

Systemprofile:

Kein Systemprofil creado. [anlegen]

XProfan:

 Contribución  Font  Smilies  ▼ 

Bitte registro en una Contribución a verfassen.
 

Tema opciones

1.257 Views

Untitledvor 0 min.
Normann Strübli08.10.2020
Ernst11.01.2015
Edmund Coenen28.05.2013
iF07.05.2013

Themeninformationen

Dieses Thema ha 2 subscriber:

Detlef Jagolski (4x)
iF (3x)


Admins  |  AGB  |  Applications  |  Autores  |  Chat  |  Política de Privacidad  |  Descargar  |  Entrance  |  Ayuda  |  Merchantportal  |  Pie de imprenta  |  Mart  |  Interfaces  |  SDK  |  Services  |  Juegos  |  Búsqueda  |  Support

Ein Projekt aller XProfan, el lo son!


Mi XProfan
Privado Noticias
Eigenes Ablageforum
Temas-Merkliste
Eigene Beiträge
Eigene Temas
Zwischenablage
Cancelar
 Deutsch English Français Español Italia
Traducciones

Política de Privacidad


Wir uso Cookies sólo como Session-Cookies wegen el technischen Notwendigkeit y en uns hay no Cookies de Drittanbietern.

Wenn du hier en unsere Webseite klickst oder navigierst, stimmst du unserer Erfassung de Informationen en unseren Cookies en XProfan.Net a.

Weitere Informationen a unseren Cookies y dazu, como du el Kontrolle darüber behältst, findest du en unserer nachfolgenden Datenschutzerklärung.


einverstandenDatenschutzerklärung
Yo möchte no Cookie