Results 1 to 2 of 2

Thread: Shell Command

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Crowthorne UK
    Posts
    14

    Unhappy

    Has anyone had problems when shelling out to a command prompt, the prompt just won't appear?! If you re-boot and re-run at that point it works!
    Second time round it then got half way through the BCP batch file it was running and then hung with the same results then as before, not being able to open a command prompt. There was plenty of memory left and the batch file itself works!
    Has anyone got any ideas???!

  2. #2
    Member
    Join Date
    Aug 2000
    Posts
    60

    Cool Solution

    Have you tried using the API Call ShellExecute,

    create a form (called frmMain) and a textbox(txtFilePath) and commandbutton(cmdRun). Then paste the code below into the form code.

    Enter the path of the file you want to run and click the commandbutton. This will run the file with its associated program. (command.com or cmd.exe)

    To run a file use the following code:

    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

    Private Sub cmdRun_Click()
    Dim ReturnVal as Long

    ReturnVal = ShellExecute(frmMain.Hwnd, "open", txtFilePath.Text, "", "", 1)

    End Sub
    Grant French
    -----------------------------------------------
    E-Mail: [email protected]
    ICQ: 33122184

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