Search results for 'ShellExecuteEx'. 2 post(s) found.

  1. 2007/09/19 Display Standard Windows Properties dialog
  2. 2007/09/09 How to run shell command by MFC ?
2007/09/19 08:31

Display Standard Windows Properties dialog


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;

Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 00:26 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 08:52 delete

    moneyideas

  3. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:40 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