Results 1 to 5 of 5

Thread: Calling a Server Side Application in ASP

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142

    Question

    Does anyone know how I could launch a server side application in ASP (VBScript) ??

    This is essential to some image processing (thumbnails) that I am doing.. see my Thumbnail thread for more info.

    Thanks much!

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    This works if the exe displays no output I tried it with notepad and then with a batch file but it didn't work - no error though either !

    start a new ActiveX dll add the code below and compile it so the DLL is in your system dir (I'm not sure whether the location matters or not but for the time being it's best to narrow the odds of it working!)

    Project1.Class1:
    Code:
    Option Explicit
    
    Public Function RunExe(ByVal Filename As String) As Long
    On Error Resume Next
    
    Shell Filename
    
    'return the error if any
    RunExe = Err.Number
    
    End Function
    your Active server page can then call the DLL like this

    runexe.asp:
    Code:
    <%@ Language=VBScript %>
    
    <html>
    
    
    <%
    dim obj
    set obj = server.CreateObject("Project1.Class1")
    
    Response.Write("Error Code: " & obj.runexe("c:\mbs.exe"))
    %>
    
    	
    </HTML>


    Here's the trivial app to test it.
    Just a module no forms.

    mbs.exe:

    Code:
    Option Explicit
    
    Sub Main()
    Dim fnum As Byte
    fnum = FreeFile
    
    Open "C:\mbs.mbs" For Output As fnum
    Print #fnum, Now()
    Close fnum
    
    End Sub
    Mark
    -------------------

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    wow...thanks mark.

    i had never actually compiled my own dll before...
    but the code you provided worked great!

    thanks a bunch.

    you wouldn't happen to know how to kill the app after i have finished with it would you?

    merci!

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Hey I'm pretty impressed as well because I made tht up my self and it's remarkably simular to this which I just found!

    http://www.4guysfromrolla.com/webtech/072199-2.shtml
    Mark
    -------------------

  5. #5
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    cool thanx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width