Home > Software engineering >  With c # code into VB6 code
With c # code into VB6 code

Time:09-27

Excuse me each great god a c # code below can be converted into VB6 code?
 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. The Arguments=string Concat (new string [] {Pfile_Path "/F=", "\ ", 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;
}
}
The catch (Exception ex)
{
Throw the ex.
}
The finally
{
Proc. Close ();
Proc. The Dispose ();
}

CodePudding user response:

Fyi:
 Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long 
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 the SYNCHRONIZE=& amp; 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 (the SYNCHRONIZE, 0, pId)
If pHnd & lt;> 0 Then
Do
R=WaitForSingleObject (pHnd, 1000) ', etc.
1 SECDoEvents
Loop While r & lt;> 0 And terminateFlag=False
Call the CloseHandle (pHnd)
End the If
End Sub
Private Sub Command1_Click ()
Dim f As Integer
Dim ln the As String
ShellWait + Pproc_name + CMD/c "" "" "" "/F="+ Prpt_file Pfile_Path +" \ "+ +"/p/x
"F=FreeFile ()
Open For Input with a "y: \ info. Ini" As # f
The Line Input # f, ln
The Debug. Print ln
Close # f
End Sub
  • Related