source: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Dialog.ab@ 637

Last change on this file since 637 was 637, checked in by イグトランス (egtra), 16 years ago

Button.OnClickの仕組みを汎用的(WM_COMMAND全般)に。WndProcなどをProtectedへ。

File size: 1.2 KB
Line 
1#include "Form.ab"
2
3Namespace ActiveBasic
4Namespace Windows
5Namespace UI
6
7Class Dialog
8 Inherits Form
9Public
10 Function DoModal(hwndParent As HWND) As Long
11 Dim temp[31] As Byte
12 SetWord(temp + 0, 1) '拡張テンプレート
13 SetWord(temp + 2, &hffff)
14 SetDWord(temp + 12, DS_MODALFRAME Or WS_SYSMENU)
15 StartWndProc()
16 DoModal = DialogBoxIndirectParam(Control.hInstance, temp As *DLGTEMPLATE, hwndParent, AddressOf(DefDlgProc), 0)
17 End Function
18Protected
19 Override Function DefWndProc(m As DWord, w As WPARAM, l As LPARAM) As LRESULT
20 DefWndProc = FALSE
21 End Function
22
23Private
24 Static Function DefDlgProc(hDlg As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LONG_PTR
25 Dim lr = Control.WndProcFirst(hDlg, msg, wp, lp)
26 If lr <> 0 Then
27 Select Case msg
28 Case WM_CHARTOITEM, _
29 WM_COMPAREITEM, _
30 WM_CTLCOLORBTN, _
31 WM_CTLCOLORDLG, _
32 WM_CTLCOLOREDIT, _
33 WM_CTLCOLORLISTBOX, _
34 WM_CTLCOLORSCROLLBAR, _
35 WM_CTLCOLORSTATIC, _
36 WM_INITDIALOG, _
37 WM_QUERYDRAGICON, _
38 WM_VKEYTOITEM
39
40 DefDlgProc = lr
41 Case Else
42 _System_SetWindowLongPtr(hDlg, DWLP_MSGRESULT, lr)
43 End Select
44 End If
45 End Function
46
47End Class
48
49End Namespace
50End Namespace
51End Namespace
Note: See TracBrowser for help on using the repository browser.