Ignore:
Timestamp:
Jul 21, 2008, 1:26:05 AM (16 years ago)
Author:
イグトランス (egtra)
Message:

UI_Sampleの追加。イベントのコメントアウト解除。Form.abからテスト部分を除去。Application.DoEventsを実装。MakeControlEventHandlerを静的メンバのイベント対応へ。WindowsExceptionの追加。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Control.ab

    r551 r559  
    9191        Imports System.Runtime.InteropServices
    9292
     93        If hwnd <> 0 Then
     94            Throw New System.InvalidOperationException("Window already created.")
     95        End If
     96
    9397        Dim gch = GCHandle.Alloc(This)
    9498        TlsSetValue(tlsIndex, GCHandle.ToIntPtr(gch) As VoidPtr)
     
    101105                .x, .y, .cx, .cy, .hwndParent, .hMenu, .hInstance, .lpCreateParams)
    102106            If hwnd = 0 Then
     107                Debug
    103108                ActiveBasic.Windows.ThrowByWindowsError(GetLastError())
    104109            End If
     
    251256
    252257    Sub OnCreateBase(sender As Object, e As MessageArgs)
    253 '       OnCreate(New CreateArgs(e.LParam As *CREATESTRUCT))
     258        OnCreate(New CreateArgs(e.LParam As *CREATESTRUCT))
    254259    End Sub
    255260
     
    333338            ' ウィンドウが作られて最初にWndProcFirstが呼ばれたとき
    334339
    335             If AssociateHWnd(gch, hwnd) = False Then
    336                 Goto *InstanceIsNotFound
    337             End If
     340            AssociateHWnd(gch, hwnd)
    338341        End If
    339342        If msg = WM_NCDESTROY Then
     
    349352
    350353    *InstanceIsNotFound
    351         OutputDebugString(Ex"ActiveBasic.Windows.UI.Control.WndProcFirst: The attached instance is not found.\r\n")
     354        Dim err = "ActiveBasic.Windows.UI.Control.WndProcFirst: The attached instance is not found. msg = &h" _
     355            + Hex$(msg) + Ex"\r\n"
     356        OutputDebugString(ToTCStr(err))
    352357        WndProcFirst = DefWindowProc(hwnd, msg, wp, lp)
    353358    End Function
     
    360365    これを実行することで、UnassociateHWndされるまでControlがGC対象にならなくなる。
    361366    */
    362     Static Function AssociateHWnd(gch As System.Runtime.InteropServices.GCHandle, hwnd As HWND) As Boolean
     367    Static Sub AssociateHWnd(gch As System.Runtime.InteropServices.GCHandle, hwnd As HWND)
    363368        Imports System.Runtime.InteropServices
    364369        Dim rThis = gch.Target As Control
    365370        If IsNothing(rThis) Then
    366             Exit Function
     371            Exit Sub
    367372        End If
    368373        rThis.hwnd = hwnd
    369374        rThis.Prop[PropertyInstance] = GCHandle.ToIntPtr(gch) As HANDLE
    370     End Function
     375    End Sub
    371376
    372377    /*!
Note: See TracChangeset for help on using the changeset viewer.