I am using the following statements in VFP.
DECLARE INTEGER ShellExecute IN shell32.DLL ;
INTEGER hndWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin
**
cAction = "open"
cFileName = "c:\temp\ping_servers.exe"
cParams = ALLTRIM(In_Params)
cPath = "c:\temp\"
mrtn = ShellExecute(0,cAction,cFileName,cParams,cPath,1)
As you can see, I pass variables to my vb.net application, ping_servers.exe
this is my vb.net code being called
Imports System.Net.NetworkInformation
Imports System.Text
Imports System.Environment
Public Class ping_servers
Dim lretval As Integer = -1
Dim gserver As String
Public Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim gserver As String
TextBox2.Text =
This is My vb.ne
'gserver = Trim(TextBox2.Text)
gserver = Trim(Environment.GetCommandLineArgs(1))
lretval = ping(gserver)
If lretval = True Then
MessageBox.Show("Ping is Successful")
Else
MessageBox.Show("Ping failed")
End If
Return
Me.Dispose()
End Sub
Public Function ping(ByVal server As String) As String
Dim reply As System.Net.NetworkInformation.PingReply
Dim p As New System.Net.NetworkInformation.Ping
Try
reply = p.Send(server, 1000)
If reply.Status.ToString = "Success" Then
lretval = True
End If
Catch ex As Exception
lretval = False
End Try
Return lretval
End Function
End Class
I knoow this routine works, I display the messagebox stating 'Ping successfulle/fail)
what I need to do, is to return the value of the variable lretval (wgich is either true or false) back to the calling rprogram
in this case vfp
the mrtn mentioned above returns a value that represents a successful call, not the actual value
I am relatively new at vb.net and I have been looking around and can not seem to find exactly what I need
I've tried environment.exitcode, but i have not been abole to pass it back to vfp
Any comments/suggestions greatly appreciated
thanks in advance
DECLARE INTEGER ShellExecute IN shell32.DLL ;
INTEGER hndWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin
**
cAction = "open"
cFileName = "c:\temp\ping_servers.exe"
cParams = ALLTRIM(In_Params)
cPath = "c:\temp\"
mrtn = ShellExecute(0,cAction,cFileName,cParams,cPath,1)
As you can see, I pass variables to my vb.net application, ping_servers.exe
this is my vb.net code being called
Imports System.Net.NetworkInformation
Imports System.Text
Imports System.Environment
Public Class ping_servers
Dim lretval As Integer = -1
Dim gserver As String
Public Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim gserver As String
TextBox2.Text =
This is My vb.ne
'gserver = Trim(TextBox2.Text)
gserver = Trim(Environment.GetCommandLineArgs(1))
lretval = ping(gserver)
If lretval = True Then
MessageBox.Show("Ping is Successful")
Else
MessageBox.Show("Ping failed")
End If
Return
Me.Dispose()
End Sub
Public Function ping(ByVal server As String) As String
Dim reply As System.Net.NetworkInformation.PingReply
Dim p As New System.Net.NetworkInformation.Ping
Try
reply = p.Send(server, 1000)
If reply.Status.ToString = "Success" Then
lretval = True
End If
Catch ex As Exception
lretval = False
End Try
Return lretval
End Function
End Class
I knoow this routine works, I display the messagebox stating 'Ping successfulle/fail)
what I need to do, is to return the value of the variable lretval (wgich is either true or false) back to the calling rprogram
in this case vfp
the mrtn mentioned above returns a value that represents a successful call, not the actual value
I am relatively new at vb.net and I have been looking around and can not seem to find exactly what I need
I've tried environment.exitcode, but i have not been abole to pass it back to vfp
Any comments/suggestions greatly appreciated
thanks in advance