emi_sastra
asked on
CALLING AN APPLICATION FROM WITHIN AN APPLICATION
Hi All,
I try to open an app from within an app.
Module mdlMain
Public Sub Main(ByVal pArgs() As String)
If pArgs.Length > 0 Then
For intI As Int32 = 0 To pArgs.Length - 1
pArgs(intI) = pArgs(intI).ToUpper
Select Case intI
Case 0
ERV_Global.strLoginUserID = pArgs(intI)
Case 1
ERV_Global.strLoginUserNam e = pArgs(intI)
End Select
Next
End If
MsgBox(pArgs.Length) -----> return 0
Application.Run(frmMain)
End Sub
Caller :
Dim p As New Process()
p.EnableRaisingEvents = False
p.StartInfo.UseShellExecut e = False
p.StartInfo.CreateNoWindow = True
p.StartInfo.FileName = strApplicationName
p.StartInfo.Arguments = ERV_Global.strLoginUserID & " " & ERV_Global.strLoginUserNam e.Trim
p.Start()
What's wrong ?
Thank you.
I try to open an app from within an app.
Module mdlMain
Public Sub Main(ByVal pArgs() As String)
If pArgs.Length > 0 Then
For intI As Int32 = 0 To pArgs.Length - 1
pArgs(intI) = pArgs(intI).ToUpper
Select Case intI
Case 0
ERV_Global.strLoginUserID = pArgs(intI)
Case 1
ERV_Global.strLoginUserNam
End Select
Next
End If
MsgBox(pArgs.Length) -----> return 0
Application.Run(frmMain)
End Sub
Caller :
Dim p As New Process()
p.EnableRaisingEvents = False
p.StartInfo.UseShellExecut
p.StartInfo.CreateNoWindow
p.StartInfo.FileName = strApplicationName
p.StartInfo.Arguments = ERV_Global.strLoginUserID & " " & ERV_Global.strLoginUserNam
p.Start()
What's wrong ?
Thank you.
ASKER
Hi Idle_Mind,
- Are you sure you're actually passing valid arguments?
Yes, It is.
I have seen from a link said that below code make some problem for passing arguments,
I forget where is it and how to overcome this.
p.StartInfo.UseShellExecut e = False
p.StartInfo.CreateNoWindow = True
First, I use this because I want to avoid cmd window still active after calling the batch file.
Thank you.
- Are you sure you're actually passing valid arguments?
Yes, It is.
I have seen from a link said that below code make some problem for passing arguments,
I forget where is it and how to overcome this.
p.StartInfo.UseShellExecut
p.StartInfo.CreateNoWindow
First, I use this because I want to avoid cmd window still active after calling the batch file.
Thank you.
Not sure about that.
What are the values that ultimately end up in these?
p.StartInfo.FileName = strApplicationName
p.StartInfo.Arguments = ERV_Global.strLoginUserID & " " & ERV_Global.strLoginUserNam e.Trim
What are the values that ultimately end up in these?
p.StartInfo.FileName = strApplicationName
p.StartInfo.Arguments = ERV_Global.strLoginUserID & " " & ERV_Global.strLoginUserNam
ASKER
strApplicationName + "ERV_INVENTORY"
ERV_Global.strLoginUserID = "EMI"
ERV_Global.strLoginUserNam e.Trim = "ABCD123"
Thank you.
ERV_Global.strLoginUserID = "EMI"
ERV_Global.strLoginUserNam
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Idle_Mind,
I am sorry, my mistakes.
The p.StartInfo.FileName = batch file name., should be app name without ".exe".
Why I call the bacth file because it runs below code :
@ECHO OFF
CD D:\EMI NEW\COMPILED\MKE\
COPY D:\SERVER\ERV\ERV_INVENTOR Y.EXE>NULL
ERV_INVENTORY.EXE
What I suppose to do if without it ?
Thank you.
I am sorry, my mistakes.
The p.StartInfo.FileName = batch file name., should be app name without ".exe".
Why I call the bacth file because it runs below code :
@ECHO OFF
CD D:\EMI NEW\COMPILED\MKE\
COPY D:\SERVER\ERV\ERV_INVENTOR
ERV_INVENTORY.EXE
What I suppose to do if without it ?
Thank you.
"should be app name without ".exe""
So you need?
p.StartInfo.FileName = System.IO.Path.GetFileName WithoutExt ension(str Applicatio nName)
So you need?
p.StartInfo.FileName = System.IO.Path.GetFileName
ASKER
So you need?
p.StartInfo.FileName = System.IO.Path.GetFileName WithoutExt ension(str Applicatio nName)
Yes, it works now. But I still need to copy exe file from server to caller computer that is done by the batch file.
Thank you.
p.StartInfo.FileName = System.IO.Path.GetFileName
Yes, it works now. But I still need to copy exe file from server to caller computer that is done by the batch file.
Thank you.
ASKER
Hi Idle_Mind,
Thank you very much for your help.
Thank you very much for your help.
p.StartInfo.Arguments = ERV_Global.strLoginUserID & " " & ERV_Global.strLoginUserNam
MessageBox.Show(p.StartInf
p.Start()