- UID
- 240679
- 帖子
- 286
- 主題
- 57
- 精華
- 0
- 積分
- 252
- 楓幣
- 284
- 威望
- 250
- 存款
- 382
- 贊助金額
- 0
- 推廣
- 0
- GP
- 72
- 閱讀權限
- 30
- 在線時間
- 47 小時
- 註冊時間
- 2018-7-14
- 最後登入
- 2023-9-8
|
小弟獻醜,大佬見笑了。
需要物件:Button *1、TextBox *2
Module:
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32
Public hwnd As Integer
<DllImport("user32.dll")> Function SetWindowText(ByVal hwnd As IntPtr, ByVal lpString As String) As Integer
End Function
Public Sub ReadTitle(ByVal RDTitle As String)
hwnd = FindWindow(vbNullString, RDTitle) '讀取指定程式視窗
End Sub
Public Sub ModTitle(ByVal RDFormText As TextBox, ByVal MDFormText As TextBox)
ReadTitle(RDFormText.Text)
SetWindowText(hwnd, MDFormText.Text)
End Sub
Form:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ModTitle(TextBox1, TextBox2)
End Sub
|
|