Search results for 'ShellExecute'. 5 post(s) found.

  1. 2009/09/09 How to launch application ?
  2. 2009/09/09 How to print external document ?
  3. 2007/09/20 How to install an INF file using Delphi ?
  4. 2007/09/09 How to run shell command by MFC ?
  5. 2007/08/25 How To Open Url In Default Webbrowser
2009/09/09 07:56

How to launch application ?


You can launch application on windows by ShellExecute function. Following is the simple example to launch application.

use ShellAPI;

.
.
.

ShellExecute(Handle, 'open', PChar('c:\test\app.exe'), nil, nil, SW_SHOW);


In case of running DOS command application such as batch file and you want not to display user, put SW_HIDE in the function option as follow

ShellExecute(Handle, 'open', PChar('c:\test\kurapa_backup.bat'), nil, nil, SW_HIDE);

Trackback 0 Comment 0

Trackback : Cannot send a trackbact to this post.

2009/09/09 07:53

How to print external document ?


Without complex programming, you can Print document by ShellExecute function.

use ShellAPI;

.
.
.

ShellExecute(Handle, 'Print', PChar('c:\test\test.doc'), nil, nil, SW_SHOW);
Trackback 0 Comment 0

Trackback : Cannot send a trackbact to this post.

2007/09/20 08:36

How to install an INF file using Delphi ?


If you need to install an "inf" file using Delphi, you could use the next code:

{
Usage:
  InstallINF('C:\XYZ.inf', 0) ;
}
uses
  ShellAPI;

function InstallINF(const PathName: string; hParent: HWND): Boolean;
var
  instance: HINST;
begin
  instance := ShellExecute(hParent,
    PChar('open'),
    PChar('rundll32.exe'),
    PChar('setupapi,InstallHinfSection DefaultInstall 132 ' + PathName),
    nil,
    SW_HIDE) ;

  Result := instance > 32;
end;
Trackback 8 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject Animal sex.

    Tracked from Animal sex clips. 2009/01/04 01:08 delete

    Free animal sex videos. Animal sex videos. Male animal sex. Farm animal sex. Animal sex.

  2. Subject Xanax.

    Tracked from Xanax 2 mg 180 pills. 2009/01/15 08:12 delete

    Buy xanax. Xanax as a party drug. Xanax.

  3. Subject Mother son incest.

    Tracked from Incest free. 2009/01/16 09:42 delete

    Incest taboo rape photo. Free family incest pictures. Incest.

  4. Subject Viagra 6 free samples.

    Tracked from Viagra without a prescription. 2009/02/06 09:40 delete

    Viagra. Viagra side effects.

  5. Subject Vicodin.

    Tracked from Symptoms vicodin addiction. 2009/06/08 13:59 delete

    Vicodin hp. Darvocet vs vicodin. Vicodin. Vicodin without prescription. Mexican vicodin. Abuse of vicodin.

  6. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 03:04 delete

    moneyideas

  7. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 12:14 delete

    moneyideas

  8. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:41 delete

    moneyideas

2007/09/09 15:56

How to run shell command by MFC ?


Followings are the useful example can run shell command.

/*

    Programmed 1998 by Kurapa Chunun Kang (kurapa@kurapa.com)

    By below function, you can run shell command easily.

*/

#include <shellapi.h>

void KShellExecute(HWND handle, LPCTSTR exe, LPCTSTR param, LPCTSTR dir)
{
    DWORD ExitCode;
    ShellExecuteINFO SEInfo;

    memset( &SEInfo, 0, sizeof(SEInfo));
    SEInfo.cbSize = sizeof(ShellExecuteINFO);

    SEInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
    SEInfo.hwnd = handle;
    SEInfo.lpFile = exe;
    SEInfo.lpParameters = param;
    SEInfo.lpDirectory = dir;
    SEInfo.nShow = SW_HIDE; // SW_SHOWNORMAL;


    if (ShellExecuteEx(&SEInfo)==TRUE)
    {
        do
        {
            GetExitCodeProcess(SEInfo.hProcess, &ExitCode);
            Sleep(500);
        } while (ExitCode); // wait until the command is finished
    }
}


If you want to launch browser for specific URL, simple run as below:
.
.
.
above source
.
.
.

KShellExecute( NULL, "http://strcpy.com",NULL, NULL);
* Note: The above code must be included in the same source.
Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 05:14 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 14:01 delete

    moneyideas

  3. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:38 delete

    moneyideas

2007/08/25 09:44

How To Open Url In Default Webbrowser


Use this function to open your browser with a given URL.

uses 
  shellapi; 

.... 

procedure TForm1.Label1Click(Sender:TObject); 
begin 
  ShellExecute(handle,'open','http://www.swissdelphicenter.ch',
nil,nil,SW_SHOW); 
end;

Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/28 23:04 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 07:17 delete

    moneyideas

  3. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:38 delete

    moneyideas