How to close ShellExecute() in the program?

How to close ShellExecute() in the program?

Postby dutch » Sun Jul 04, 2010 6: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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to close ShellExecute() in the program?

Postby dutch » Sun Jul 04, 2010 7: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: Select all  Expand view
#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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to close ShellExecute() in the program?

Postby dutch » Sun Jul 04, 2010 7:27 am

I've got it. I use SendMessage() to close virtual keyboard. It works.
Code: Select all  Expand view
SendMessage( FindWindow( 0, "Free Virtual Keyboard (www.FreeVirtualKeyboard.com)" ), WM_CLOSE )

Thanks.
Regards,
Dutch

FWH 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 19 guests