请问各路大神下面这段C#代码可以转换成VB6的代码吗?
Process proc = new Process();
try
{
proc.StartInfo.FileName = Pproc_name;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardInput = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.Arguments = string.Concat(new string[] { "/F=", Pfile_Path, "\\", Prpt_file, " /p /x" });
proc.Start();
while (!proc.HasExited)
{
proc.WaitForExit(1000);
} string errormsg = proc.StandardError.ReadToEnd();
proc.StandardError.Close();
if (String.IsNullOrEmpty(errormsg))
{
Flag = true;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
proc.Close();
proc.Dispose();
}
Process proc = new Process();
try
{
proc.StartInfo.FileName = Pproc_name;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardInput = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.Arguments = string.Concat(new string[] { "/F=", Pfile_Path, "\\", Prpt_file, " /p /x" });
proc.Start();
while (!proc.HasExited)
{
proc.WaitForExit(1000);
} string errormsg = proc.StandardError.ReadToEnd();
proc.StandardError.Close();
if (String.IsNullOrEmpty(errormsg))
{
Flag = true;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
proc.Close();
proc.Dispose();
}
解决方案 »
- vb6。0中有file控件吗?
- 求一正则表达式,分割HTML标签中的DIV,高分,在线等
- 正在做系统,需要帮助!
- 请问一下!当我浏览dudu.com时候,就会自动下载并且安装一个dudu下载加速器?并且没有数字签名安全警告!他这个是怎么做到的?
- winsock 的端口问题 (曾经有人提过,但是没得到确切的答案,近日再提,希望引起各位的关注!)
- 如何在程序中显示表格,并能修改表格,并且希望表格的内容集成在程序中
- directx 问题 在线等待
- ADO问题 mshflexgrid 绑定数据集
- 招聘:VB及VC开发
- 郁闷ing!!!我想用VB编一个程序来显示Word文档,但用什么控件来显示Word文档呢?
- 求大神给个通过IP地址来判定链路正常与否的代码(可检测出丢包等问题)
- 求VBA 批量对比数据
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Const SYNCHRONIZE = &H100000
Dim terminateFlag As Boolean
Private Sub Form_Load()
terminateFlag = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
terminateFlag = True
End Sub
Private Sub ShellWait(cmd As String)
Dim pId As Long, pHnd As Long, r As Long
pId = Shell(cmd, vbHide)
pHnd = OpenProcess(SYNCHRONIZE, 0, pId)
If pHnd <> 0 Then
Do
r = WaitForSingleObject(pHnd, 1000) '等1秒
DoEvents
Loop While r <> 0 And terminateFlag = False
Call CloseHandle(pHnd)
End If
End Sub
Private Sub Command1_Click()
Dim f As Integer
Dim ln As String
ShellWait "cmd /c “”“+Pproc_name+“”“ /F="+ Pfile_Path+ "\"+ Prpt_file+ " /p /x"
f=FreeFile()
Open "y:\info.ini" For Input As #f
Line Input #f, ln
Debug.Print ln
Close #f
End Sub