Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening More Application

Status
Not open for further replies.

Krelek500

Programmer
Joined
Jun 3, 2003
Messages
9
Location
US
What command should I use if I want to open another application using Visual Basic as a root application? The object is a novell application

Thx
Krelek
 
Check out the Shell command

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
I'm unable to use the shell command due to spaces in the file name.

Is there a way to pass info to and/or from an OLE object?
 
use its shortname, i think there is an api to get a programs short file name..... somewhere.
sorry only know of it not what it is :(
 

Niphyr would be referring to the Win32 API function:
Code:
Public Declare Function GetShortPathName Lib "kernel32" _
    Alias "GetShortPathNameA" ( _
    ByVal lpszLongPath As String, _
    ByVal lpszShortPath As String, _
    ByVal cchBuffer As Long) _
    As Long

HTH,
Cassie
 
Shell appears to work for me with spaces in either the program name or the file-to-be opened name, using VB6 and XP

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Krelek500,
What Windows are you running?

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif

 
I was able to execute the file as an OLE object but I need to know if information can be passed between applications?

I am trying to get a SQL statement from the application to run in VB in order to program a set of reports that I am working on.
 

Example usage:
Code:
Public Function GetShortPath(strFileName As String) As String
    Dim lngReturnCode As Long
    Dim strPath As String * 255
    lngReturnCode = GetShortPathName(strFileName, strPath, 255)
    GetShortPath = Left(strPath, lngReturnCode)
End Function
 
if the program you are running excepts command line parameters you can...

Some programs also let you script commands...

such as:
Open a text file (text.sql)...
write the commands to it...
Close it...

then use shell to execute the SQL commands via the text file...

this might look something like:
Shell "SQL.EXE text.sql"

you can then use the KILL statement to delete the script file...

Also to get info back into VB you might need to pipe the output to a text file...

If you have documentation for the application, you should read through it carefully before trying any of these methods...

Here is an example of what we used to have to do...

Code:
  FileName = "C:\MyDocu~1\" + PrtNum.Text + ".TXT"
  If Dir(FileName) <> &quot;&quot; THen
    Dim MQL As String
    MQL = &quot;set context user &quot; & SETUSER & &quot; password &quot; & SETPASS & &quot;;&quot; & vbCrLf & _
          &quot;checkin businessobject Note &quot; & PrtNum & &quot; &quot; & REV & &quot; '&quot; & FileName & &quot;';&quot; & vbCrLf & _
          &quot;quit;&quot; & vbCrLf

    Open &quot;C:\Temp\RUNMQL.TXT&quot; For Output As #1
      Print #1, MQL
    Close #1
    Open &quot;C:\Temp\RUNMQL.BAT&quot; For Output As #1
      Print #1, &quot;start /WAIT C:\EMATRIX\BIN\WINNT\MQL.EXE -stdin:c:\Temp\RUNMQL.TXT&quot;
    Close #1
    retval = Shell(&quot;C:\Temp\RUNMQL.BAT&quot;, vbNormalFocus)
  End If

We now use commands via a DLL that was included in the package that was discovered after fully reading the documentation...

*note: MQL is a SQL spinoff for the eMatrix PDM dBase...
which stands for Matrix Query Language

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top