Hi,
  
Tips about a problem with "run" function in PB10.5.
When we use this function to call an external program, it runs the
external program, but does not wait for the external program to end -THE
FOCUS DOES NOT STAY ON THE EXTERNAL APPLICATION BUT GOES BACK TO THE
CALLER APPLICATION. 
 
There is a way to make make the focus stay on the external application.  
The same works fine in PB7.

we can use this:

//structure
$PBExportHeader$s_shellexecuteinfo.srs
global type s_shellexecuteinfo from structure
        long            l_cbSize
        long            l_fMask
        long            l_hwnd
        string          s_lpVerb
        string          s_lpFile
        string          s_lpParameters
        string          s_lpDirectory
        long            l_nShow
        long            l_hInstApp
        long            l_lpIDList
        string          s_lpClass
        long            l_hkeyClass
        long            l_dwHotKey
        long            l_hIcon
        long            l_hProcess
end type

//external functions
Function boolean ShellExecuteEx(ref s_shellexecuteinfo hwnd) Library "shell32.dll" Alias for "ShellExecuteExA"
Function Long WaitforSingleObject(Long hObject,ULong dwTimeout) Library 'Kernel32.dll' Alias For 'WaitForSingleObject'

//code
Constant ULong SEE_MASK_NOCLOSEPROCESS=64 //0x40
Constant ULong SEE_MASK_FLAG_DDEWAIT=256  //0x100
Constant ULong INFINITE=4294967295        //0xFFFFFFFF
Constant ULong SW_SHOWNORMAL=1

s_shellexecuteinfo lsei_info

lsei_info.l_cbsize=60
lsei_info.l_fMask=SEE_MASK_NOCLOSEPROCESS+SEE_MASK_FLAG_DDEWAIT
lsei_info.l_hWnd=handle(this)
lsei_info.s_lpVerb='open'
lsei_info.s_lpFile=ls_name
lsei_info.l_nShow=SW_SHOWNORMAL;
if ShellExecuteEx(lsei_info) then
  WaitForSingleObject(lsei_info.l_hProcess,INFINITE)
end if
 
 
 
cheers,
 
untung d.s.

----- Original Message -----
Sent: Thursday, June 08, 2006 4:03 PM
Subject: [indopb] Tanya close program

Dear All,
Ada yang tahu bagaimana script untuk closing program ,
kalau mau jalankan program scriptnya : run (c:\test.exe)
bagaimana untuk closenya ?

Thanks

Hery

.


Internal Virus Database is out-of-date.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.7/214 - Release Date: 12/23/2005
__._,_.___

-----------------------------------------------
IndoPB - Indonesia PB User Group
An Indonesian PowerBuilder User Group's Event
2nd PowerBuilder Update
Mezzanine Floor Hotel Ibis Slipi
26/27 August 2006
To Register :
http://groups.yahoo.com/group/indopb/database?method=addRecord&tbl=4





SPONSORED LINKS
Computer monitoring software Computer and internet software Free computer monitoring software


YAHOO! GROUPS LINKS




__,_._,___

Kirim email ke