Buchempfehlung
Visual Basic 6 Kochbuch
Visual Basic 6 Kochbuch
Viele praktische Tipps zum Programmieren mit Visual Basic 6, die sich oft auch auf FB übertragen lassen. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

Window_Ext.bas

Uploader:MitgliedEternal_Pain
Datum/Zeit:07.03.2014 14:24:06

#include once "Window_Ext.bi"

'------------------'
Constructor List_Windows()
    Globals.ClassName = "Win32App"
    Dim as String     ClassName = Globals.ClassName
    Dim as HINSTANCE  hInstance = GetModuleHandle(NULL)
    Dim as WNDCLASSEX wcex
    wcex.cbSize         = sizeof(WNDCLASSEX)
    wcex.style          = CS_HREDRAW OR CS_VREDRAW
    wcex.lpfnWndProc    = @WndProc
    wcex.cbClsExtra     = 0
    wcex.cbWndExtra     = 0
    wcex.hInstance      = hInstance
    wcex.hIcon          = LoadIcon(NULL, IDI_WINLOGO)
    wcex.hCursor        = LoadCursor(NULL, IDC_ARROW)
    wcex.hbrBackground  = Cast(HBRUSH,(COLOR_WINDOW+1))
    wcex.lpszMenuName   = NULL
    wcex.lpszClassName  = strptr(ClassName)
    wcex.hIconSm        = NULL

    If (RegisterClassEx(@wcex)=0) Then MessageBox(NULL,"Register failed!", "Error", NULL) : End
End Constructor

'------------------'
Sub List_Windows.AddWindow(byref thiswindow as Node_Windows ptr)
    If (thiswindow = 0) Then Exit Sub
    thiswindow -> PrevWindow = LastWindow
    thiswindow -> NextWindow = 0

    If LastWindow Then
        LastWindow -> NextWindow = thiswindow
    Else
        FirstWindow = thiswindow
    End If

    LastWindow = thiswindow
    WindowCount += 1
End Sub

'------------------'
Sub List_Windows.DelWindow(byref thiswindow as Node_Windows ptr)
    If (thiswindow = 0) Then Exit Sub

    'Items löschen

    If (thiswindow -> NextWindow) Then
        thiswindow -> NextWindow -> PrevWindow = thiswindow -> PrevWindow
    Else
        LastWindow = thiswindow -> PrevWindow
    End If

    If (thiswindow -> PrevWindow) Then
        thiswindow -> PrevWindow -> NextWindow = thiswindow -> NextWindow
    Else
        FirstWindow = thiswindow -> NextWindow
    End If

    Delete thiswindow
    thiswindow = 0
    WindowCount -= 1
End Sub

'------------------'
Sub List_Windows.Destroy()
    While FirstWindow
        DelWindow(FirstWindow)
    Wend
End Sub




'******************************************************************************************************************************************************************************************************************'
' WNDPROC
Function WndProc(byval h_Wnd as HWND, byval u_Msg as UINT, byval wParam as WPARAM, byval lParam as LPARAM) as LRESULT
    Dim as any ptr CDTPTR

    If (u_Msg = WM_CREATE) Then
        CDTPTR = Cast(LPCREATESTRUCT,lparam)->lpCreateParams
        SetWindowLongPtr(h_Wnd, GWLP_USERDATA, cast(LONG_PTR,CDTPTR))
        ?Globals.WindowList.WindowCount
    Else
        CDTPTR = Cast(any ptr,GetWindowLongPtr(h_Wnd, GWLP_USERDATA))
    End If

    Select Case u_Msg

        Case WM_DESTROY
            PostQuitMessage(0)

    End Select


    return DefWindowProc(h_Wnd, u_Msg, wParam, lParam)
End Function