Search results for 'ShellExecute'. 5 post(s) found.
- 2009/09/09 How to launch application ?
- 2009/09/09 How to print external document ?
- 2007/09/20 How to install an INF file using Delphi ?
- 2007/09/09 How to run shell command by MFC ?
- 2007/08/25 How To Open Url In Default Webbrowser
You can launch application on windows by ShellExecute function. Following is the simple example to launch application.
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);
Another posts included in "Delphi"
| Is there directory selection VCL component in Delphi ? (0) | 2009/09/09 |
| How to print external document ? (0) | 2009/09/09 |
| Delphi API to get windows temporary directory (0) | 2009/09/03 |
| Delphi API to get the current working directory (0) | 2009/09/03 |
| How to resize PNG file in Delphi ? (0) | 2009/09/03 |
| Get the length of arrays and a string (0) | 2009/08/22 |
Trackback : Cannot send a trackbact to this post.
Without complex programming, you can Print document by ShellExecute function.
Another posts included in "Delphi"
| How to launch application ? (0) | 2009/09/09 |
| Is there directory selection VCL component in Delphi ? (0) | 2009/09/09 |
| Delphi API to get windows temporary directory (0) | 2009/09/03 |
| Delphi API to get the current working directory (0) | 2009/09/03 |
| How to resize PNG file in Delphi ? (0) | 2009/09/03 |
| Get the length of arrays and a string (0) | 2009/08/22 |
| Delphi Pointer Types (0) | 2009/08/22 |
Trackback : Cannot send a trackbact to this post.
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;
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;
Another posts included in "Delphi"
| How to play sounds on the PC Speaker ? (0) | 2007/09/20 |
| How to remove your application from TaskBar (0) | 2007/09/25 |
| How to track a user's idle time (0) | 2007/09/25 |
| How to determine the output of a console application ? (0) | 2007/09/20 |
| Get text from the control at pos x,y on screen (0) | 2007/09/20 |
| Get dimensions of usable space on monitor (work area) (0) | 2007/09/20 |
| Get system info (free memory, etc) (0) | 2007/09/20 |
| How to Get Filenames from Clipboard ? (0) | 2007/09/20 |
Trackback : Cannot send a trackbact to this post.
-
Subject Animal sex.
2009/01/04 01:08
Free animal sex videos. Animal sex videos. Male animal sex. Farm animal sex. Animal sex.
-
Subject Xanax.
2009/01/15 08:12
Buy xanax. Xanax as a party drug. Xanax.
-
Subject Mother son incest.
2009/01/16 09:42
Incest taboo rape photo. Free family incest pictures. Incest.
-
Subject Viagra 6 free samples.
2009/02/06 09:40
Viagra. Viagra side effects.
-
Subject Vicodin.
2009/06/08 13:59
Vicodin hp. Darvocet vs vicodin. Vicodin. Vicodin without prescription. Mexican vicodin. Abuse of vicodin.
-
Subject different money making ideas
2010/01/29 03:04
moneyideas
-
Subject different money making ideas
2010/01/29 12:14
moneyideas
-
Subject different money making ideas
2010/01/31 16:41
moneyideas
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
}
}
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:
* Note: The above code must be included in the same source.
Another posts included in "C, C++"
| How to search file on certain directory ? (0) | 2008/06/16 |
| How to call SetTimer function on MFC CDialog class ? (0) | 2008/07/30 |
| How to get GM Time as String ? (0) | 2009/03/20 |
| Binary Search Sample Code (0) | 2007/09/08 |
| Double Linked List (0) | 2007/09/08 |
| MFC based World Wide Web HTTP Server Source Code (0) | 2007/08/28 |
| Creating and Using a CAsyncSocket Object to use CAsyncSocket (0) | 2007/08/28 |
| UDP Send and Receive Using CAsyncSocket (0) | 2007/08/28 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 05:14
moneyideas
-
Subject different money making ideas
2010/01/29 14:01
moneyideas
-
Subject different money making ideas
2010/01/31 16:38
moneyideas
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;
shellapi;
....
procedure TForm1.Label1Click(Sender:TObject);
begin
ShellExecute(handle,'open','http://www.swissdelphicenter.ch',
nil,nil,SW_SHOW);
end;
Another posts included in "Delphi"
| How To Send An E-mail By Code (0) | 2007/08/25 |
| How can I hide the caption bar on a form? (0) | 2007/08/25 |
| How To Make A Gradient Filled Form (0) | 2007/08/25 |
| How To Check If A Soundcard Is Installed (0) | 2007/08/25 |
| How To Change Screen Resolution (0) | 2007/08/25 |
| How To Force The Correct Decimal Separator (0) | 2007/08/25 |
| How To Register Own File Types (0) | 2007/08/25 |
| How To Get Volume Name (0) | 2007/08/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/28 23:04
moneyideas
-
Subject different money making ideas
2010/01/29 07:17
moneyideas
-
Subject different money making ideas
2010/01/31 16:38
moneyideas

Prev

Rss Feed