作者k10120421 (膣屄人)
看板Visual_Basic
標題[VB6 ] 呼叫外部程式後改視窗名字
時間Tue Jun 9 15:58:10 2015
小弟有個需求想請前輩幫忙,如標題,不知道哪裡出問題沒反應
程式碼如下
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://webptt.com/m.aspx?n=bbs/Visual_Basic/M.1433836692.A.E60.html
1F:→ wenyonba: 來問問題連排版也不排好,根本懶得看~~ 06/11 11:57