[VB6 ] 呼叫外部程式後改視窗名字
小弟有個需求想請前輩幫忙,如標題,不知道哪裡出問題沒反應
程式碼如下
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpC
lassName As String, ByVal lpWindowName As String) As LongPublic Declare Functi
on SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVa
l lpString As String) As Long
Sub Main()
Dim ProcessID As Long
Dim hwnd As Long
Dim MyTitle As String
MyTitle = "My First Program"ProcessID = Shell("CALC.EXE", vbNormalFocus)
If ProcessID <> 0 Then hwnd = FindWindow("SciCalc", "Calculator"
If ProcessID = 0 Or hwnd = 0 ThenꀠꀠMsgBox "Can't execute calculator"ꀠꀊEnd
End If
SetWindowText hwnd, MyTitle
End Sub
請前輩幫忙看看哪邊有問題?謝謝
--
Sent from my Android
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.231.79.92
※ 文章網址: https://www.ptt.cc/bbs/Visual_Basic/M.1433836692.A.E60.html
→
06/11 11:57, , 1F
06/11 11:57, 1F
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章