FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to close ShellExecute() in the program?
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
How to close ShellExecute() in the program?
Posted: Sun Jul 04, 2010 06:59 AM

I would like to use external program from my application, I will use ShellExecute() but how to close ShellExecute() dialog.

I use in my old application (FW25/Clip52)

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How to close ShellExecute() in the program?
Posted: Sun Jul 04, 2010 07:06 AM
I would like to use external program and close after :end() as following code but it works for 32bits. I need to use it with my old pragram in 16bits.
How to change this code to 16bits (Clip52/FW25).
link to download FreeVK.EXE http://www.freevirtualkeyboard.com/
Code (fw): Select all Collapse
#include 'fivewin.ch'
*--------------------*
Procedure main
local oDlg, oGet[2]
local cVar1, cVar2
local hCalc := CreateProcess( "FreeVK" )

cVar1 := space(100)
cVar2 := space(100)
DEFINE DIALOG oDlg FROM 0, 0 TO 200, 400 TITLE 'Test Virtual Keyboard' PIXEL

@ 10, 10 SAY 'Test Get ' OF oDlg PIXEL SIZE 30,12
@  8, 45 GET oGet[1] VAR cVar1 OF oDlg SIZE 60,12 PIXEL 

@ 30, 10 SAY 'Test Get ' OF oDlg PIXEL SIZE 30,12
@ 28, 45 GET oGet[2] VAR cVar2 OF oDlg SIZE 60,12 PIXEL 

ACTIVATE DIALOG oDlg CENTERED VALID (TerminateProcess( hCalc ), .T.)
return 

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

HB_FUNC( CREATEPROCESS )
{
   STARTUPINFO StartupInfo;
   PROCESS_INFORMATION ProcessInfo;
   DWORD dwExitCode;

   memset( ( char * ) &StartupInfo, 0, sizeof( STARTUPINFO ) );
   StartupInfo.cb = sizeof( StartupInfo );
   StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
   StartupInfo.wShowWindow = ( hb_pcount() > 1 ) ? hb_parni( 2 ) : SW_SHOWNA;
   CreateProcess( 0, ( char * ) hb_parc( 1 ), 0, 0, FALSE,
                  CREATE_NEW_CONSOLE | NORMAL_PRIORITY_CLASS,
                  0, 0, &StartupInfo, &ProcessInfo );
   hb_retnl( ( LONG ) ProcessInfo.hProcess );                                 
}

HB_FUNC( TERMINATEPROCESS )
{
   hb_retl( TerminateProcess( ( HANDLE ) hb_parnl( 1 ), hb_parnl( 2 ) ) );
}   

#pragma ENDDUMP
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How to close ShellExecute() in the program?
Posted: Sun Jul 04, 2010 07:27 AM
I've got it. I use SendMessage() to close virtual keyboard. It works.
Code (fw): Select all Collapse
SendMessage( FindWindow( 0, "Free Virtual Keyboard (<!-- w --><a class="postlink" href="http://www.FreeVirtualKeyboard.com">www.FreeVirtualKeyboard.com</a><!-- w -->)" ), WM_CLOSE )

Thanks.
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion