Hello
I need execute the web explorer and wait until this close.
With WaitRun() using "Rundll32" dont work
ShellExecute() open but return the control to program.
I read that ShellexExecuteEx has more control but i think this is not ported to FW / Harbour.
Any one has it?
Regards
Shellexecuteex is ported to FW / Harbour ?
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Shellexecuteex is ported to FW / Harbour ?
I Implemented it this way for FWPPC (FiveWin for Pocket PC) long time ago:
I have not tested it but it may work. Use it as WaitRunEx() with the same params as WaitRun()
I have not tested it but it may work. Use it as WaitRunEx() with the same params as WaitRun()
Code: Select all
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
LPWSTR AnsiToWide( LPSTR cAnsi );
LPSTR WideToAnsi( LPWSTR cWide );
static HINSTANCE ShellExecute( HWND hWnd, LPSTR lpOperation, LPSTR lpFile, LPSTR lpParameters,
LPSTR lpDirectory, INT nShowCmd, BOOL bWait )
{
SHELLEXECUTEINFO sei;
LPWSTR pWVerb = AnsiToWide( lpOperation );
LPWSTR pWFile = AnsiToWide( lpFile );
LPWSTR pWParams = AnsiToWide( lpParameters );
LPWSTR pWDir = AnsiToWide( lpDirectory );
HINSTANCE hRes;
memset( &sei, 0, sizeof( sei ) );
sei.cbSize = sizeof( sei );
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
sei.hwnd = hWnd;
sei.lpVerb = pWVerb;
sei.lpFile = pWFile;
sei.lpParameters = pWParams;
sei.lpDirectory = pWDir;
sei.nShow = nShowCmd;
hRes = ( HINSTANCE ) ShellExecuteEx( &sei );
hb_xfree( pWVerb );
hb_xfree( pWFile );
hb_xfree( pWParams );
hb_xfree( pWDir );
if( bWait )
WaitForSingleObject( sei.hProcess, INFINITE );
return hRes;
}
HB_FUNC( WAITRUNEX )
{
LPSTR lpCmdLine = ( char * ) hb_parc( 1 );
UINT uCmdShow = hb_parnl( 2 );
hb_retnl( ( LONG ) ShellExecute( ( HWND ) 0, "open", lpCmdLine, "", "", uCmdShow, TRUE ) );
}
#pragma ENDDUMP