[VB6 ] 呼叫外部程式後改視窗名字

作者: k10120421 (膣屄人)   2015-06-09 15:58:10
小弟有個需求想請前輩幫忙,如標題,不知道哪裡出問題沒反應
程式碼如下
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
請前輩幫忙看看哪邊有問題?謝謝
作者: wenyonba (射後不理很XX啊!!!!)   2015-06-11 11:57:00
來問問題連排版也不排好,根本懶得看~~

Links booklink

Contact Us: admin [ a t ] ucptt.com