Shellexecuteex is ported to FW / Harbour ?

Shellexecuteex is ported to FW / Harbour ?

Postby hidroxid » Sat May 14, 2016 7:52 pm

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
hidroxid
 
Posts: 30
Joined: Sun Apr 24, 2011 12:50 am

Re: Shellexecuteex is ported to FW / Harbour ?

Postby Antonio Linares » Sat May 14, 2016 8:21 pm

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()

Code: Select all  Expand view
#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
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41858
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 55 guests