#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    7
    Rep Power
    0

    Running external exe's


    Thi is probly an easy noob question for many of you to answer, but can someone tell how you run an external exe from within a delphi program?

    thx plmqaz.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    191
    Something like this:
    Code:
    Uses ShellAPI;
    ...
    ShellExecute("program.exe", "param1 param2 param3", SW_SHOWNORMAL, 0);
    (straight from my head - look up the parameter order and meanings in the WinAPI help.)

    hth,
    M.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    7
    Rep Power
    0

    Thx


    Hey cheers for the help,

    This is the line of code I used in the end, it's a bit bodged as I don't know what the HWnd property is.

    Is there any glaring mistakes or possible improvements.

    (The code is basically ment to reload itself)

    ShellExecute(AllocateHWnd(WndProc), '', PAnsiChar(Application.ExeName), '', '', 0);

    thx plmqaz
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    191
    hWnd is the handle to the parent window. You can use "Application.Handle" here.

    M.

IMN logo majestic logo threadwatch logo seochat tools logo