- Timestamp:
- Jul 21, 2008, 1:26:05 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Control.ab
r551 r559 91 91 Imports System.Runtime.InteropServices 92 92 93 If hwnd <> 0 Then 94 Throw New System.InvalidOperationException("Window already created.") 95 End If 96 93 97 Dim gch = GCHandle.Alloc(This) 94 98 TlsSetValue(tlsIndex, GCHandle.ToIntPtr(gch) As VoidPtr) … … 101 105 .x, .y, .cx, .cy, .hwndParent, .hMenu, .hInstance, .lpCreateParams) 102 106 If hwnd = 0 Then 107 Debug 103 108 ActiveBasic.Windows.ThrowByWindowsError(GetLastError()) 104 109 End If … … 251 256 252 257 Sub OnCreateBase(sender As Object, e As MessageArgs) 253 'OnCreate(New CreateArgs(e.LParam As *CREATESTRUCT))258 OnCreate(New CreateArgs(e.LParam As *CREATESTRUCT)) 254 259 End Sub 255 260 … … 333 338 ' ウィンドウが作られて最初にWndProcFirstが呼ばれたとき 334 339 335 If AssociateHWnd(gch, hwnd) = False Then 336 Goto *InstanceIsNotFound 337 End If 340 AssociateHWnd(gch, hwnd) 338 341 End If 339 342 If msg = WM_NCDESTROY Then … … 349 352 350 353 *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)) 352 357 WndProcFirst = DefWindowProc(hwnd, msg, wp, lp) 353 358 End Function … … 360 365 これを実行することで、UnassociateHWndされるまでControlがGC対象にならなくなる。 361 366 */ 362 Static Function AssociateHWnd(gch As System.Runtime.InteropServices.GCHandle, hwnd As HWND) As Boolean367 Static Sub AssociateHWnd(gch As System.Runtime.InteropServices.GCHandle, hwnd As HWND) 363 368 Imports System.Runtime.InteropServices 364 369 Dim rThis = gch.Target As Control 365 370 If IsNothing(rThis) Then 366 Exit Function371 Exit Sub 367 372 End If 368 373 rThis.hwnd = hwnd 369 374 rThis.Prop[PropertyInstance] = GCHandle.ToIntPtr(gch) As HANDLE 370 End Function375 End Sub 371 376 372 377 /*!
Note:
See TracChangeset
for help on using the changeset viewer.