English
Source / code snippets

Mdi Nproc

 

 {$cleq}
Declare WndClass#
Declare FrameClass#
Declare ClientCreateStruct#
Declare Msg#
Declare hWndFrame&
Declare hWndClient&
Declare hMenu&
Declare hPopupMenu&
Declare mdiChild&
Struct TWindowClass = ~WNDCLASS
Struct TMsg = ~MSG
Struct TClientCreateStruct = ~CLIENTCREATESTRUCT
Dim Msg#,TMsg
Var FrameClass$      = "MDIFRAME"
Var FrameName$       = "MDI-Anwendung"
Var MDIClientClass$  = "MDICLIENT"
Var MDIChildClass$   = "MDICHILD"
Var MDIChildName$    = "CHILD"
Var ChildUp&         = 2000
Var File$           = "&Datei"
Var New$             = "&Neu"
var terminate$         = "&Beenden"
'****************************************************************************************

Proc Menu

    hMenu&      =  ~CreateMenu()
    hPopupMenu& = ~CreateMenu()
    ~AppendMenu(hPopupMenu&,~MF_POPUP,101,Addr(New$))
    ~AppendMenu(hPopupMenu&,~MF_POPUP,102,Addr(terminate$))
    ~AppendMenu(hMenu&,~MF_POPUP, hPopupMenu&, Addr(File$))

ENDPROC

'****************************************************************************************

Proc WinMain

    Dim FrameClass#,TWindowClass

    With FrameClass#

        .style&          = ~CS_HREDRAW | ~CS_VREDRAW
        .lpfnWndProc&    = ProcAddr(FrameWndProc,4)
        .cbClsExtra&     = 0
        .cbWndExtra&     = 0
        .hInstance&      = %hInstance
        .hIcon&          = ~LoadIcon(0,~IDI_Winlogo)
        .hCursor&        = ~LoadCursor(0, ~IDC_ARROW)
        .hbrBackground&  = ~createsolidbrush(~getSysColor(4))
        .lpszMenuName&   = 0
        .lpszClassName&  = Addr(FrameClass$)

    EndWith

    ~RegisterClass(FrameClass#)
    Dispose FrameClass#
    Dim WndClass#,TWindowClass

    With WndClass#

        .style&          = ~CS_HREDRAW | ~CS_VREDRAW
        .lpfnWndProc&    = ProcAddr(MDIChildProc,4)
        .cbClsExtra&     = 0
        .cbWndExtra&     = 0
        .hInstance&      = %hInstance
        .hIcon&          = 0
        .hCursor&        = ~LoadCursor(0, ~IDC_ARROW)
        .hbrBackground&  = ~createsolidbrush(~getSysColor(0))
        .lpszMenuName&   = 0
        .lpszClassName&  = Addr(MDIChildClass$)

    EndWith

    ~RegisterClass(WndClass#)
    Dispose WndClass#
    hWndFrame& = ~CreateWindowEx(                                                         \
    0,                                                                    \
    Addr(FrameClass$),                                                    \
    Addr(FrameName$),                                                     \
    ~WS_CAPTION | ~WS_MINIMIZEBOX | ~WS_SYSMENU | ~WS_CLIPCHILDREN |      \
    ~WS_VISIBLE,      \
    200,                                                                  \
    100,                                                                  \
    698,                                                                  \
    542,                                                                  \
    0,                                                                    \
    0,                                                                    \
    %hInstance,                                                           \
    0)
    Menu
    ~SetMenu(hWndFrame&,hMenu&)
    Dim ClientCreateStruct#,TClientCreateStruct

    With ClientCreateStruct#

        .hWindowMenu&   = ~GetSubMenu(~GetMenu(hWndFrame&),1)
        .idFirstChild&  = ChildUp&

    EndWith

    hWndClient& = ~CreateWindowEx(                                                        \
    ~WS_EX_CLIENTEDGE,                                                   \
    Addr(MDIClientClass$),                                               \
    0,                                                                   \
    ~WS_CHILD | ~WS_CLIPCHILDREN | ~WS_CLIPSIBLINGS | ~WS_VISIBLE |      \
    ~MDIS_ALLCHILDSTYLES,      \
    0,                                                                   \
    0,                                                                   \
    700,                                                                 \
    500,                                                                 \
    hWndFrame&,                                                          \
    0,                                                                   \
    %hInstance,                                                          \
    ClientCreateStruct#)

    While ~GetMessage(Msg#, 0, 0, 0) > 0

        ~TranslateMessage(Msg#)

        if (long(msg#,4)=wm_user+1)

            case (long(msg#,12)=1) : newWindow()

        endif

        ~DispatchMessage(Msg#)

    EndWhile

    Return Msg#.wParam&

ENDPROC

'****************************************************************************************

Proc NewWindow

    mdiChild& = ~CreateMDIWindow(                                                         \
    Addr(MDIChildClass$),                                                  \
    Addr(MDIChildname$),                                                   \
    ~WS_CAPTION | ~WS_MINIMIZEBOX | ~WS_SYSMENU | ~WS_VISIBLE,             \
    40,                                                                    \
    40,                                                                    \
    300,                                                                   \
    200,                                                                   \
    hwndclient&,                                                           \
    %hinstance,                                                            \
    0)

ENDPROC

'****************************************************************************************

nProc FrameWndProc

    Parameters Wnd&, Message&, wParam&, lParam&
    global hWndClient&

    If Message& = ~WM_COMMAND

        If wParam& = 101

            postMessage(Wnd&,wm_user+1,0,1)

        ElseIf wParam& = 102

            SendMessage(hWndClient&,~WM_MDIGETACTIVE,0,0)
            SendMessage(Wnd&,~WM_CLOSE,0,0)

        EndIf

    ElseIf Message& = ~WM_CLOSE

    ElseIf Message& = ~WM_DESTROY

        ~PostQuitMessage(0)

    EndIf

    Return ~DefFrameProc(Wnd&, hWndClient&, Message&, wParam&, lParam&)

ENDPROC

'****************************************************************************************

nProc MDIChildProc

    Parameters Wnd&,Message&, wParam&, lParam&
    global hWndClient&

    If Message& = ~WM_CLOSE

        SendMessage(hWndClient&,~WM_MDIDESTROY,Wnd&,0)

    Else

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

    EndIf

ENDPROC

'****************************************************************************************
WinMain
Dispose Msg#
Dispose ClientCreateStruct#
 
05/07/13  
 




Ernst
Hello David,
many Thanks for your HIlfe (I had with the Grundcode almost any Procs To nProcs make want....) - now macht's slow correctly. Fun

only: Why attend no (new)Childs, if I in lieu of {$cleq} whom switch {$iq} einsetze ?

be already self draufgekommen: Set("FastMode",1) insert, then geht's

Regards serious
 
05/07/13  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.227 Views

Untitledvor 0 min.
Gast.081510/03/24
Member 862464105/12/24
p.specht01/19/22
Uwe Lang11/20/21
More...

Themeninformationen

this Topic has 2 subscriber:

Ernst (1x)
iF (1x)


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