Click to See Complete Forum and Search --> : Calling a Server Side Application in ASP
dvst8
May 26th, 2000, 01:19 AM
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!
Mark Sreeves
May 29th, 2000, 09:25 PM
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 ! :confused:
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:
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:
<%@ 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:
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
dvst8
May 29th, 2000, 09:52 PM
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!
Mark Sreeves
Jun 1st, 2000, 06:28 PM
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
da_silvy
Dec 5th, 2000, 04:46 AM
cool thanx
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.