Search results for 'ShellExecuteEx'. 2 post(s) found.
- 2007/09/19 Display Standard Windows Properties dialog
- 2007/09/09 How to run shell command by MFC ?
Here's the code that will display the standard Windows Properties dialog for a specified file (object) name.
Usage:
ShowProperties(Application.Handle, 'c:\autoexec.bat')
Here's the function source.
function ShowProperties(hWndOwner: HWND; const FileName: string): boolean;
var
Info: TSHELLEXECUTEINFO;
Handle : THandle;
begin
{ Fill in the SHELLEXECUTEINFO structure }
with Info do
begin
cbSize := SizeOf(Info) ;
fMask := SEE_MASK_NOCLOSEPROCESS or
SEE_MASK_INVOKEIDLIST or
SEE_MASK_FLAG_NO_UI;
wnd := hWndOwner;
lpVerb := 'properties';
lpFile := pChar(FileName) ;
lpParameters := nil;
lpDirectory := nil;
nShow := 0;
hInstApp := 0;
lpIDList := nil;
end;
{ Call Windows to display the properties dialog. }
Result := ShellExecuteEx(@Info) ;
end;
var
Info: TSHELLEXECUTEINFO;
Handle : THandle;
begin
{ Fill in the SHELLEXECUTEINFO structure }
with Info do
begin
cbSize := SizeOf(Info) ;
fMask := SEE_MASK_NOCLOSEPROCESS or
SEE_MASK_INVOKEIDLIST or
SEE_MASK_FLAG_NO_UI;
wnd := hWndOwner;
lpVerb := 'properties';
lpFile := pChar(FileName) ;
lpParameters := nil;
lpDirectory := nil;
nShow := 0;
hInstApp := 0;
lpIDList := nil;
end;
{ Call Windows to display the properties dialog. }
Result := ShellExecuteEx(@Info) ;
end;
Another posts included in "Delphi"
| Disable ALT+TAB, CTRL+ESC, CTRL+ALT+DEL (0) | 2007/09/19 |
| Get Windows Temp directory (0) | 2007/09/20 |
| How to Get Windows OS Version ? (0) | 2007/09/20 |
| Disable Mouse and Keyboard from Delphi Code (0) | 2007/09/19 |
| Detecting Drive Types (0) | 2007/09/19 |
| Detecting and preventing Windows shut down (0) | 2007/09/19 |
| Create new program group in the Start menu (0) | 2007/09/19 |
| Copying Group of Files using Delphi with Standard Animation Dialog (SHF... (0) | 2007/09/19 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 00:26
moneyideas
-
Subject different money making ideas
2010/01/29 08:52
moneyideas
-
Subject different money making ideas
2010/01/31 16:40
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

Prev

Rss Feed