问题描述
嗨!
我正在设计用户界面,因此遇到了新问题.我需要打开特定的软件并强制其自动执行某些功能.
以下创建的代码仅创建该过程:
Public Sub APT_upload(等待时间为整数)
试试
将APT_Process变暗为新的System.Diagnostics.Process
使用APT_Process
.EnableRaisingEvents = True
结尾为
将APT_ProcessInfo变暗为新的ProcessStartInfo
使用APT_ProcessInfo
.UseShellExecute = False
.WindowStyle = ProcessWindowStyle.Normal
.FileName =" C:\ xxx \ xxx.exe"
结尾为
APT_Process = Process.Start(APT_ProcessInfo)
******在这里做些事情!
?????????
****************************************
如果APT_Process.Id<> 0然后,过程存在"
其他
MsgBox(无法从以下位置打开APT:& APT_ProcessInfo.FileName)
如果结束
WaitDelay(WaitTime)
Dim procesos As Process()
过程=任务管理器中的Process.GetProcessesByName("xxx")'
如果procesos.Length> 0然后
对于i = procesos.Length-1至0步骤-1
procesos(i).Kill()
下一个
如果结束
procesos =没事
退出子
异常捕获
MessageBox.Show(ex.Message)
结束尝试
结束
但是我如何在该exe文件中自动调用子功能?我需要知道方法名称还是只使用引用的dll:s?
最好的问候.
Vesa
Hi!
Im designing user-interface and I faced new problem. I need to open specific software and force it to make some functions automatically.
Following code I have created just creates the process:
Public Sub APT_upload(WaitTime As Integer)
Try
Dim APT_Process As New System.Diagnostics.Process
With APT_Process
.EnableRaisingEvents = True
End With
Dim APT_ProcessInfo As New ProcessStartInfo
With APT_ProcessInfo
.UseShellExecute = False
.WindowStyle = ProcessWindowStyle.Normal
.FileName = "C:\xxx\xxx.exe"
End With
APT_Process = Process.Start(APT_ProcessInfo)
******DO SOMETHING HERE!!!***********
????????
************************************
If APT_Process.Id <> 0 Then 'process exist
Else
MsgBox("Cannot open APT from: " & APT_ProcessInfo.FileName)
End If
WaitDelay(WaitTime)
Dim procesos As Process()
procesos = Process.GetProcessesByName("xxx") 'from task manager
If procesos.Length > 0 Then
For i = procesos.Length - 1 To 0 Step -1
procesos(i).Kill()
Next
End If
procesos = Nothing
Exit Sub
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
But how I can call subfunction/functionality inside that exe automatically? I Need to know method names or just using referenced dll:s?
Best Regards.
Vesa
这篇关于通过使用VBNET程序调用外部.EXE子功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!