Calling a VB Script file from VisualBasic
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Calling a VB Script file from VisualBasic

  1. #1
    Join Date
    Nov 2001
    Location
    USA
    Posts
    1

    Calling a VB Script file from VisualBasic

    Could you any one give me hint on steps to RUN a VBScript (.vbs) file from a VisualBasic DLL. I dont want to wait for the response back.
    Any help in this regard is appreciated.

    Sree

  2. #2
    Join Date
    Mar 2000
    Location
    Arizona, USA
    Posts
    493

    Re: Calling a VB Script file from VisualBasic

    try this

    public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (byval hwnd as Long, byval lpszOp as string, byval lpszFile as string, byval lpszParams as string, byval lpszDir as string, byval FsShowCmd as Long) as Long
    public Declare Function GetDesktopWindow Lib "user32" () as Long

    public Function ExecuteFile(strCmdLine as string, optional strParams as string)
    Dim Scr_hDC as Long

    on error resume next

    '//Execute A File
    Scr_hDC = GetDesktopWindow()
    ExecuteFile = ShellExecute(Scr_hDC, "Open", strCmdLine, strParams, "C:\", SW_SHOWNORMAL)

    End Function

    private Sub CreateShortcut()

    '//Create Shortcut on Desktop
    ExecuteFile ("C:\WI Applications\Shortcuts.vbs")

    End Sub



    Just pass in the command line and any parameters

    Kris
    Software Engineer
    Phoenix,AZ
    Kris
    Software Engineer
    Phoenix, AZ USA

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center