by のぶあや » 2006年10月15日(日) 10:25
確認したところ、DLLのCallback.wbpには
[ここをクリックすると内容が表示されます] [ここをクリックすると非表示にします]コード: 全て選択
'このファイルはウィンドウ定義ファイル(*.wnd)をもとに生成されています
Const Static1=1000
Dim hModal As HWND
Dim hFont_Modal As HFONT
hFont_Modal=CreateFont(-12,0,0,0,400,0,0,0,128,3,2,1,32,"MS Pゴシック")
Dim h3DFaceBrush As HBRUSH
h3DFaceBrush=CreateSolidBrush(GetSysColor(COLOR_3DFACE))
Sub D_DestroyObjects()
DeleteObject(hFont_Modal)
DeleteObject(h3DFaceBrush)
End Sub
Function EventCall_Modal(hWnd As HWND, message As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
Select Case message
Case WM_INITDIALOG
hModal=hWnd
CreateWindowEx(&H00000000,"STATIC","Text1",&H50000000,151,142,50,12,hWnd,Static1 As HMENU,GetModuleHandle(0),0)
SendMessage(GetDlgItem(hWnd,Static1),WM_SETFONT,hFont_Modal As WPARAM,0)
Case WM_DESTROY
Case WM_CLOSE
Dim cancel=0 As Integer
If cancel=0 Then EndDialog(hWnd,0)
Case Else
EventCall_Modal=DefWindowProc(hWnd,message,wParam,lParam)
Exit Function
End Select
EventCall_Modal=0
End Function
Function DefaultCallProc(hWnd As HWND, message As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
DefaultCallProc=DefWindowProc(hWnd,message,wParam,lParam)
End Function
Dim _RadSys_dlgwcl As WNDCLASSEX
FillMemory(VarPtr(_RadSys_dlgwcl),Len(_RadSys_dlgwcl),0)
_RadSys_dlgwcl.cbSize=Len(_RadSys_dlgwcl)
_RadSys_dlgwcl.hInstance=GetModuleHandle(0)
_RadSys_dlgwcl.style=CS_HREDRAW or CS_VREDRAW or CS_DBLCLKS
_RadSys_dlgwcl.hIcon=LoadIcon(NULL,MAKEINTRESOURCE(IDI_APPLICATION))
_RadSys_dlgwcl.hIconSm=LoadIcon(NULL,MAKEINTRESOURCE(IDI_WINLOGO))
_RadSys_dlgwcl.hCursor=LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW))
_RadSys_dlgwcl.lpszClassName="NORMALDLG"
_RadSys_dlgwcl.hbrBackground=h3DFaceBrush
_RadSys_dlgwcl.lpfnWndProc=AddressOf(DefaultCallProc)
RegisterClassEx(_RadSys_dlgwcl)
Function DialogBox(hOwnerWnd As HWND, TemplateName As LPSTR) As LONG_PTR
Dim hDlg As HWND
If lstrcmp(TemplateName,"Modal")=0 Then
hModal=CreateWindowEx(&H00000000,"NORMALDLG","Modal",&H00c80000,-1,-1,480,360,hOwnerWnd,0 As HMENU,GetModuleHandle(0),0)
hDlg=hModal
SetWindowLong(hModal,GWL_WNDPROC,AddressOf(ModalProc) As LONG_PTR)
SendMessage(hModal,WM_INITDIALOG,0,0)
ShowWindow(hModal,SW_SHOW)
Else
Exit Function
End If
EnableWindow(hOwnerWnd,0)
Dim msg As MSG, iResult As Long
Do
iResult=GetMessage(msg,0,0,0)
If iResult=0 or iResult=-1 Then Exit Do
If IsDialogMessage(hDlg,msg) Then Continue
TranslateMessage(msg)
DispatchMessage(msg)
Loop
DialogBox=msg.wParam
End Function
Sub EndDialog(hWnd As HWND, lResult As Long)
EnableWindow(GetWindow(hWnd,GW_OWNER),1)
DestroyWindow(hWnd)
PostMessage(0,WM_QUIT,lResult,0)
End Sub
Function CreateDialog(hOwnerWnd As HWND, TemplateName As LPSTR) As HWND
End Function
とありました。
フォントの作成は
コード: 全て選択
Dim hFont_Modal As HFONT
hFont_Modal=CreateFont(-12,0,0,0,400,0,0,0,128,3,2,1,32,"MS Pゴシック")
とプログラム側と同じになっているので正常に作られていると思います。
フォントの参照ですが、DialogBox関数内で
コード: 全て選択
SendMessage(hModal,WM_INITDIALOG,0,0)
とWM_INITDIALOGが送られ、EventCall_Modal関数内で
コード: 全て選択
Case WM_INITDIALOG
hModal=hWnd
CreateWindowEx(&H00000000,"STATIC","Text1",&H50000000,151,142,50,12,hWnd,Static1 As HMENU,GetModuleHandle(0),0)
SendMessage(GetDlgItem(hWnd,Static1),WM_SETFONT,hFont_Modal As WPARAM,0)
となっているので、WM_SETFONTでフォントが参照されていると思うのですが・・・。
ちなみにプログラム側ではMainWndしかないのでDialogBox関数を覗いても
変数(hDlg As HWND)が1個定義されているだけでした。
またCallback.wbpの元となる*.wndファイルには
コード: 全て選択
FONT = -12,0,0,0,400,0,0,0,128,3,2,1,32,"MS Pゴシック"
となっていました。(プログラム側、DLL側の両方とも)
確認したところ、DLLのCallback.wbpには
[hide][code]'このファイルはウィンドウ定義ファイル(*.wnd)をもとに生成されています
Const Static1=1000
Dim hModal As HWND
Dim hFont_Modal As HFONT
hFont_Modal=CreateFont(-12,0,0,0,400,0,0,0,128,3,2,1,32,"MS Pゴシック")
Dim h3DFaceBrush As HBRUSH
h3DFaceBrush=CreateSolidBrush(GetSysColor(COLOR_3DFACE))
Sub D_DestroyObjects()
DeleteObject(hFont_Modal)
DeleteObject(h3DFaceBrush)
End Sub
Function EventCall_Modal(hWnd As HWND, message As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
Select Case message
Case WM_INITDIALOG
hModal=hWnd
CreateWindowEx(&H00000000,"STATIC","Text1",&H50000000,151,142,50,12,hWnd,Static1 As HMENU,GetModuleHandle(0),0)
SendMessage(GetDlgItem(hWnd,Static1),WM_SETFONT,hFont_Modal As WPARAM,0)
Case WM_DESTROY
Case WM_CLOSE
Dim cancel=0 As Integer
If cancel=0 Then EndDialog(hWnd,0)
Case Else
EventCall_Modal=DefWindowProc(hWnd,message,wParam,lParam)
Exit Function
End Select
EventCall_Modal=0
End Function
Function DefaultCallProc(hWnd As HWND, message As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
DefaultCallProc=DefWindowProc(hWnd,message,wParam,lParam)
End Function
Dim _RadSys_dlgwcl As WNDCLASSEX
FillMemory(VarPtr(_RadSys_dlgwcl),Len(_RadSys_dlgwcl),0)
_RadSys_dlgwcl.cbSize=Len(_RadSys_dlgwcl)
_RadSys_dlgwcl.hInstance=GetModuleHandle(0)
_RadSys_dlgwcl.style=CS_HREDRAW or CS_VREDRAW or CS_DBLCLKS
_RadSys_dlgwcl.hIcon=LoadIcon(NULL,MAKEINTRESOURCE(IDI_APPLICATION))
_RadSys_dlgwcl.hIconSm=LoadIcon(NULL,MAKEINTRESOURCE(IDI_WINLOGO))
_RadSys_dlgwcl.hCursor=LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW))
_RadSys_dlgwcl.lpszClassName="NORMALDLG"
_RadSys_dlgwcl.hbrBackground=h3DFaceBrush
_RadSys_dlgwcl.lpfnWndProc=AddressOf(DefaultCallProc)
RegisterClassEx(_RadSys_dlgwcl)
Function DialogBox(hOwnerWnd As HWND, TemplateName As LPSTR) As LONG_PTR
Dim hDlg As HWND
If lstrcmp(TemplateName,"Modal")=0 Then
hModal=CreateWindowEx(&H00000000,"NORMALDLG","Modal",&H00c80000,-1,-1,480,360,hOwnerWnd,0 As HMENU,GetModuleHandle(0),0)
hDlg=hModal
SetWindowLong(hModal,GWL_WNDPROC,AddressOf(ModalProc) As LONG_PTR)
SendMessage(hModal,WM_INITDIALOG,0,0)
ShowWindow(hModal,SW_SHOW)
Else
Exit Function
End If
EnableWindow(hOwnerWnd,0)
Dim msg As MSG, iResult As Long
Do
iResult=GetMessage(msg,0,0,0)
If iResult=0 or iResult=-1 Then Exit Do
If IsDialogMessage(hDlg,msg) Then Continue
TranslateMessage(msg)
DispatchMessage(msg)
Loop
DialogBox=msg.wParam
End Function
Sub EndDialog(hWnd As HWND, lResult As Long)
EnableWindow(GetWindow(hWnd,GW_OWNER),1)
DestroyWindow(hWnd)
PostMessage(0,WM_QUIT,lResult,0)
End Sub
Function CreateDialog(hOwnerWnd As HWND, TemplateName As LPSTR) As HWND
End Function
[/code][/hide]とありました。
フォントの作成は
[code]Dim hFont_Modal As HFONT
hFont_Modal=CreateFont(-12,0,0,0,400,0,0,0,128,3,2,1,32,"MS Pゴシック")
[/code]とプログラム側と同じになっているので正常に作られていると思います。
フォントの参照ですが、DialogBox関数内で
[code]SendMessage(hModal,WM_INITDIALOG,0,0)
[/code]とWM_INITDIALOGが送られ、EventCall_Modal関数内で
[code]Case WM_INITDIALOG
hModal=hWnd
CreateWindowEx(&H00000000,"STATIC","Text1",&H50000000,151,142,50,12,hWnd,Static1 As HMENU,GetModuleHandle(0),0)
SendMessage(GetDlgItem(hWnd,Static1),WM_SETFONT,hFont_Modal As WPARAM,0)
[/code]となっているので、WM_SETFONTでフォントが参照されていると思うのですが・・・。
ちなみにプログラム側ではMainWndしかないのでDialogBox関数を覗いても
変数(hDlg As HWND)が1個定義されているだけでした。
またCallback.wbpの元となる*.wndファイルには
[code]FONT = -12,0,0,0,400,0,0,0,128,3,2,1,32,"MS Pゴシック"
[/code]となっていました。(プログラム側、DLL側の両方とも)