by 淡幻星 » 2006年2月17日(金) 19:50
刹那さん さんが書きました:> "GetWindowTextStr" 無効な識別子です
実践コードモジュール(上記リンク先)の
「↓使うときにはこれをコピーしてください。」に示されている
コードもソース内に貼り付けてますでしょうか?
追記。
せっかくなのでGetWindowTextStr()の定義も一緒にしたコードを載せます。
こちらをクリックしてください。 [ここをクリックすると内容が表示されます] [ここをクリックすると非表示にします]コード: 全て選択
'EditBox1のEN_CHANGEイベント
Sub MainWnd_EditBox1_Change()
Dim strEdit1 As String
Dim strEdit2 As String
Dim strEdit3 As String
GetWindowTextStr( GetDlgItem(hMainWnd, EditBox1), strEdit1 ) 'strEdit1の内容を取得
GetWindowTextStr( GetDlgItem(hMainWnd, EditBox2), strEdit2 ) 'strEdit2の内容を取得
strEdit3 = strEdit1 + strEdit2
SetWindowText( GetDlgItem(hMainWnd, EditBox3), StrPtr(strEdit3) )'strEdit3に内容をセット
End Sub
'実践コードモジュールから「String型のGetWindowText」転載
Function GetWindowTextStr(hwnd As HWND, ByRef str As String) As Long
Dim Length As Long
Length = GetWindowTextLength(hwnd)
str = ZeroString(Length)
If Length = 0 Then
GetWindowTextStr = 0
Exit Function
End If
GetWindowTextStr = GetWindowText(hwnd, StrPtr(str), Length + 1)
SetDWord(StrPtr(str) - SizeOf (DWord), GetWindowTextStr)
End Function
[quote="刹那さん"]> "GetWindowTextStr" 無効な識別子です[/quote]
実践コードモジュール(上記リンク先)の
「↓使うときにはこれをコピーしてください。」に示されている
コードもソース内に貼り付けてますでしょうか?
追記。
せっかくなのでGetWindowTextStr()の定義も一緒にしたコードを載せます。
[hide=こちらをクリックしてください。][code]'EditBox1のEN_CHANGEイベント
Sub MainWnd_EditBox1_Change()
Dim strEdit1 As String
Dim strEdit2 As String
Dim strEdit3 As String
GetWindowTextStr( GetDlgItem(hMainWnd, EditBox1), strEdit1 ) 'strEdit1の内容を取得
GetWindowTextStr( GetDlgItem(hMainWnd, EditBox2), strEdit2 ) 'strEdit2の内容を取得
strEdit3 = strEdit1 + strEdit2
SetWindowText( GetDlgItem(hMainWnd, EditBox3), StrPtr(strEdit3) )'strEdit3に内容をセット
End Sub
'実践コードモジュールから「String型のGetWindowText」転載
Function GetWindowTextStr(hwnd As HWND, ByRef str As String) As Long
Dim Length As Long
Length = GetWindowTextLength(hwnd)
str = ZeroString(Length)
If Length = 0 Then
GetWindowTextStr = 0
Exit Function
End If
GetWindowTextStr = GetWindowText(hwnd, StrPtr(str), Length + 1)
SetDWord(StrPtr(str) - SizeOf (DWord), GetWindowTextStr)
End Function[/code][/hide]