作者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/cn.aspx?n=bbs/Visual_Basic/M.1433836692.A.E60.html
1F:→ wenyonba: 来问问题连排版也不排好,根本懒得看~~ 06/11 11:57