by 7 » 2005年8月23日(火) 16:31
クラスを使うことによって、CommandButton1.Caption="なまえ"、のようなことが可能です。
コード: 全て選択
Class CommandButton
Protected
c_hWnd As HWND
c_ID As Long
Public
Sub CommandButton(ByVal hWnd As HWND,ByVal ID As Long)
c_hWnd=GetDlgItem(hWnd,ID)
c_ID=ID
End Sub
Sub ~CommandButton()
c_hWnd=NULL
c_ID=NULL
End Sub
Sub Caption(ByVal lpCaption As BytePtr)
SetWindowText(c_hWnd,lpCaption)
End Sub
Sub Enable(ByVal bEnable As Long)
EnableWindow(c_hWnd,bEnable)
End Sub
End Class
Sub MainWnd_CommandButton1_Click()
Dim CommandButton1 As CommandButton(hMainWnd,CommandButton1)
CommandButton1.Caption("なまえ")
CommandButton1.Enable(FALSE)
End Sub
クラスを使わないのであれば、SetWindowText(),SetDlgItemText(),EnableWindow()をプログラムの中で使えば可能です。
これらの関数はActiveBasicのヘルプにも載ってますし、Win32APIを調べれば分かります。
ImageBoxに画像を表示するのはDISCOVERSOFTのWin32プログラミング講座を参考にしてはどうでしょう。
クラスを使うことによって、CommandButton1.Caption="なまえ"、のようなことが可能です。
[code]Class CommandButton
Protected
c_hWnd As HWND
c_ID As Long
Public
Sub CommandButton(ByVal hWnd As HWND,ByVal ID As Long)
c_hWnd=GetDlgItem(hWnd,ID)
c_ID=ID
End Sub
Sub ~CommandButton()
c_hWnd=NULL
c_ID=NULL
End Sub
Sub Caption(ByVal lpCaption As BytePtr)
SetWindowText(c_hWnd,lpCaption)
End Sub
Sub Enable(ByVal bEnable As Long)
EnableWindow(c_hWnd,bEnable)
End Sub
End Class
Sub MainWnd_CommandButton1_Click()
Dim CommandButton1 As CommandButton(hMainWnd,CommandButton1)
CommandButton1.Caption("なまえ")
CommandButton1.Enable(FALSE)
End Sub[/code]
クラスを使わないのであれば、SetWindowText(),SetDlgItemText(),EnableWindow()をプログラムの中で使えば可能です。
これらの関数はActiveBasicのヘルプにも載ってますし、Win32APIを調べれば分かります。
ImageBoxに画像を表示するのはDISCOVERSOFTのWin32プログラミング講座を参考にしてはどうでしょう。