Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1106
  • Last Modified:

shellexecute in ASP?

Is it possible to call shellexecute in ASP? If yes, how? Normally i would do the following for VB:

myResult = ShellExecute(Me.hwnd, "print", filename, vbNullString, "", SW_HIDE)
0
babypris
Asked:
babypris
  • 2
  • 2
1 Solution
 
hansamryanCommented:
Private Sub Shell(byVal command)
     dim wshShell, boolErr, strErrDesc
     On Error Resume Next
     Set wshShell = CreateObject("WScript.Shell")
     wshShell.Run command
     if Err Then
          boolErr = True
          strErrDesc = Err.Description
     end if
     Set wshShell = Nothing
     On Error GoTo 0
     if boolErr then Err.Raise 5105, "Shell Statement", strErrDesc
End Sub
0
 
hansamryanCommented:
But not sure about the print function though.
0
 
aelatikCommented:
babypris,

I don't know what you want to accomplish but the code [hansamryan] gave you will execute on server and not client side.

If you want your code to execute ( SHELL for example ) client side you must use active X controls.
0
 
babyprisAuthor Commented:
It's ok. I found the answer. thanks anyway...

Dim oWSHShell

Set oWSHShell = WScript.CreateObject("WScript.Shell")

oWSHShell.Run "Rundll32.exe MSHTML.dll,PrintHTML " & _
                 filename, 1, true
0
 
babyprisAuthor Commented:
how do you use active x?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now