Changeset 461 for trunk/Include
- Timestamp:
- Mar 8, 2008, 12:40:31 PM (17 years ago)
- Location:
- trunk/Include/Classes
- Files:
-
- 5 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/Windows/Forms/Application.ab
r388 r461 31 31 PostQuitMessage(0) 32 32 End Sub 33 34 /*! 35 @brief 現在のスレッドで標準のアプリケーション メッセージ ループの実行を開始し、 36 指定したフォームを表示します。 37 */ 38 Static Sub Run( form As Form ) 39 40 ' フォームを表示する 41 form.Show() 42 43 Dim msgMain As MSG, iResult As Long 44 Do 45 iResult=GetMessage(msgMain,0,0,0) 46 If iResult=0 or iResult=-1 Then Exit Do 47 TranslateMessage(msgMain) 48 DispatchMessage(msgMain) 49 Loop 50 End Sub 33 51 End Class 34 52 -
trunk/Include/Classes/System/Windows/Forms/Control.ab
r388 r461 1 1 ' Classes/System/Windows/Forms/Control.ab 2 2 3 #ifndef __SYSTEM_WINDOWS_FORMS_CONTROL_AB__4 #define __SYSTEM_WINDOWS_FORMS_CONTROL_AB__5 6 /*7 #require <Classes/System/Windows/Forms/misc.ab>8 #require <Classes/System/Windows/Forms/CreateParams.ab>9 #require <Classes/System/Windows/Forms/Message.ab>10 #require <Classes/System/Windows/Forms/PaintEventArgs.ab>11 #require <Classes/System/misc.ab>12 #require <Classes/System/Math.ab>13 #require <Classes/System/Threading/WaitHandle.ab>14 */15 #require <Classes/System/Drawing/Color.ab>16 #require <Classes/System/Drawing/Point.ab>17 #require <Classes/System/Drawing/Size.ab>18 #require <Classes/System/Drawing/Rectangle.ab>19 /*20 #require <Classes/System/Runtime/InteropServices/GCHandle.ab>21 #require <Classes/ActiveBasic/Windows/WindowHandle.sbp>22 #require <Classes/ActiveBasic/Strings/Strings.ab>23 */24 3 Namespace System 25 4 Namespace Windows … … 77 56 78 57 Class Control 79 80 ' Inherits IWin32Window 58 Implements IWin32Window 81 59 Public 82 60 '--------------------------------------------------------------------------- … … 100 78 'CheckForIllegalCrossThreadCalls 101 79 102 /*Override*/Function Handle() As HWND80 Override Function Handle() As HWND 103 81 Return wnd.HWnd 104 82 End Function … … 301 279 302 280 Sub init(parent As Control, text As String, left As Long, top As Long, width As Long, height As Long) 281 This.text = text 303 282 This.parent = parent 304 ' CreateControl() 283 284 Dim rgb = GetSysColor( COLOR_HIGHLIGHT ) 285 This.bkColor = New Color( GetRValue(rgb) As Byte, GetGValue(rgb) As Byte, GetBValue(rgb) As Byte ) 286 287 Dim hParentWnd = NULL As HWND 288 If Not ActiveBasic.IsNothing( parent ) Then 289 hParentWnd = parent.Handle 290 End If 291 292 createParams = New CreateParams() 293 With createParams 294 .Caption = text 295 .X = left 296 .Y = top 297 .Width = width 298 .Height = height 299 .Parent = hParentWnd 300 End With 301 302 CreateControl() 305 303 End Sub 306 304 … … 358 356 If IsWindow(hwnd) Then 359 357 If GetClassLongPtr(hwnd, GCW_ATOM) = atom Then 360 Dim gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(GetWindowLongPtr(hwnd, GWLP_THIS)) 361 Return gch.Target As Control 358 Dim lpValue = GetWindowLongPtr(hwnd, GWLP_THIS) 359 If lpValue Then 360 Dim gch = System.Runtime.InteropServices.GCHandle.FromIntPtr( lpValue ) 361 Return gch.Target As Control 362 End If 362 363 End If 363 364 End If … … 370 371 371 372 Override Function ToString() As String 372 Return text373 Return Super.ToString + ", Text: " + This.Text 373 374 End Function 374 375 … … 383 384 384 385 Sub Show() 385 Debug386 386 wnd.Show(SW_SHOW) 387 387 End Sub … … 418 418 ' Protected Methods 419 419 Virtual Sub CreateHandle() 420 Debug421 420 If Not Object.ReferenceEquals(wnd, Nothing) Then 422 421 If wnd.HWnd <> 0 Then … … 424 423 End If 425 424 End If 426 427 Dim createParams = CreateParams() 425 428 426 Dim gch = System.Runtime.InteropServices.GCHandle.Alloc(This) 429 427 TlsSetValue(tlsIndex, System.Runtime.InteropServices.GCHandle.ToIntPtr(gch) As VoidPtr) 430 With createParams 431 Dim pText As PCTSTR 432 If String.IsNullOrEmpty(text) Then 433 pText = "" As PCTSTR 434 Else 435 pText = ToTCStr(text) 436 End If 437 438 If CreateWindowEx(.ExStyle, atom As ULONG_PTR As PCSTR, pText, .Style, _ 439 .X, .Y, .Width, .Height, _ 440 .Parent, 0, hInstance, 0) = 0 Then 441 ' Error 442 Dim buf[1023] As TCHAR 443 wsprintf(buf, ToTCStr(Ex"Control: CreateWindowEx failed. Error code: &h%08X\r\n"), GetLastError()) 444 OutputDebugString(buf) 445 446 gch.Free() 428 429 Dim pText As PCTSTR 430 If String.IsNullOrEmpty(text) Then 431 pText = "" As PCTSTR 432 Else 433 pText = ToTCStr(text) 434 End If 435 436 Dim result As HANDLE 437 With This.CreateParams 438 result = CreateWindowEx( 439 .ExStyle, ' 拡張ウィンドウ スタイル 440 atom As ULONG_PTR As PCSTR, ' クラス名 441 pText, ' キャプション 442 .Style, ' ウィンドウ スタイル 443 .X, ' X座標 444 .Y, ' Y座標 445 .Width, ' 幅 446 .Height, ' 高さ 447 .Parent, ' 親ウィンドウ ハンドル 448 0, ' メニュー ハンドル 449 hInstance, ' アプリケーション インスタンス ハンドル 450 0) ' ウィンドウ作成データ 451 End With 452 453 If result = NULL Then 454 ' Error 455 Dim buf[1023] As TCHAR 456 wsprintf(buf, ToTCStr(Ex"Control: CreateWindowEx failed. Error code: &h%08X\r\n"), GetLastError()) 457 OutputDebugString(buf) 458 459 gch.Free() 447 460 ' Debug 448 ExitThread(0) 449 End If 450 End With 461 ExitThread(0) 462 End If 451 463 452 464 End Sub … … 549 561 ' Member variables 550 562 wnd As ActiveBasic.Windows.WindowHandle 563 createParams As CreateParams 551 564 text As String 552 565 parent As Control 553 566 bkColor As Color 554 555 Static createParams As CreateParams556 567 557 568 'ウィンドウ作成時にウィンドウプロシージャへThisを伝えるためのもの … … 593 604 ExitThread(0) 594 605 End If 595 596 With createParams597 ' 値は暫定的なもの598 .Style = WS_OVERLAPPEDWINDOW599 .ExStyle = WS_EX_APPWINDOW600 .Caption = String.Empty601 .X = 0602 .Y = 0603 .Width = 0604 .Height = 0605 End With606 606 End Sub 607 607 … … 672 672 End Namespace 'Widnows 673 673 End Namespace 'System 674 675 #endif '__SYSTEM_WINDOWS_FORMS_CONTROL_AB__676 -
trunk/Include/Classes/System/Windows/Forms/CreateParams.ab
r282 r461 1 ' Classes/System/Windows/Forms/CreateParams.ab2 3 #ifndef __SYSTEM_WINDOWS_FORMS_CREATEPARAMS_AB__4 #define __SYSTEM_WINDOWS_FORMS_CREATEPARAMS_AB__5 1 6 2 Namespace System … … 26 22 End Namespace 'Widnows 27 23 End Namespace 'System 28 29 #endif '__SYSTEM_WINDOWS_FORMS_CREATEPARAMS_AB__ -
trunk/Include/Classes/System/Windows/Forms/misc.ab
r388 r461 222 222 */ 223 223 224 TypeDef DialogResult = DWord225 224 TypeDef MouseButtons = DWord 226 225 -
trunk/Include/Classes/index.ab
r452 r461 38 38 #require "./System/Diagnostics/TraceListener.ab" 39 39 #require "./System/Diagnostics/TraceListenerCollection.ab" 40 /* 41 #require "./System/Drawing/CharacterRange.ab" 40 '#require "./System/Drawing/CharacterRange.ab" 42 41 #require "./System/Drawing/Color.ab" 43 #require "./System/Drawing/Font.ab"44 #require "./System/Drawing/Graphics.ab"45 #require "./System/Drawing/Image.ab"46 #require "./System/Drawing/misc.ab"42 '#require "./System/Drawing/Font.ab" 43 '#require "./System/Drawing/Graphics.ab" 44 '#require "./System/Drawing/Image.ab" 45 '#require "./System/Drawing/misc.ab" 47 46 #require "./System/Drawing/Point.ab" 48 #require "./System/Drawing/PointF.ab"47 '#require "./System/Drawing/PointF.ab" 49 48 #require "./System/Drawing/Rectangle.ab" 50 #require "./System/Drawing/RectangleF.ab"49 '#require "./System/Drawing/RectangleF.ab" 51 50 #require "./System/Drawing/Size.ab" 52 #require "./System/Drawing/SizeF.ab" 53 #require "./System/Drawing/Drawing2D/Matrix.ab" 54 #require "./System/Drawing/Drawing2D/misc.ab" 55 #require "./System/Drawing/Imaging/MetafileHeader.ab" 56 #require "./System/Drawing/Imaging/misc.ab" 57 #require "./System/Drawing/Text/misc.ab" 58 */ 51 '#require "./System/Drawing/SizeF.ab" 52 '#require "./System/Drawing/Drawing2D/Matrix.ab" 53 '#require "./System/Drawing/Drawing2D/misc.ab" 54 '#require "./System/Drawing/Imaging/MetafileHeader.ab" 55 '#require "./System/Drawing/Imaging/misc.ab" 56 '#require "./System/Drawing/Text/misc.ab" 59 57 #require "./System/IO/Directory.ab" 60 58 #require "./System/IO/DirectoryInfo.ab" … … 92 90 #require "./System/Threading/WaitHandle.ab" 93 91 #require "./System/Windows/Forms/Application.ab" 92 #require "./System/Windows/Forms/ContainerControl.ab" 94 93 #require "./System/Windows/Forms/Control.ab" 95 94 #require "./System/Windows/Forms/CreateParams.ab" 95 #require "./System/Windows/Forms/Form.ab" 96 96 #require "./System/Windows/Forms/Message.ab" 97 97 #require "./System/Windows/Forms/MessageBox.ab" 98 98 #require "./System/Windows/Forms/misc.ab" 99 99 #require "./System/Windows/Forms/PaintEventArgs.ab" 100 #require "./System/Windows/Forms/ScrollableControl.ab" 101 #require "./System/Windows/Forms/WebBrowser.ab" 102 #require "./System/Windows/Forms/WebBrowserBase.ab" 100 103 #require "./System/Xml/XmlAttribute.ab" 101 104 #require "./System/Xml/XmlCharacterData.ab"
Note:
See TracChangeset
for help on using the changeset viewer.