Alaska Software Inc. - Process Location
Username: Password:
AuthorTopic: Process Location
Nick Ramoundos Process Location
on Sun, 23 Apr 2017 01:05:35 +0200
The process names of running tasks are easily identified with the fine 
work done in GetRunningTasks() (IsAppRunning).

What I need is the fully qualified name of the process so that, after it 
has been killed and my app does its work, it can be re-started.

Is there a way to enhace GetRunningTasks() so that the array returned 
includes the full path?

To clarify, I have previously written code in VB Script as follows:
____________________________________________________________________

Set oService = GetObject ("winmgmts:")
For Each oProcess in oService.InstancesOf ("Win32_Process")
    If cProcessName = "NOTEPAD.EXE" then 
       cProgPathName = oProcess.ExecutablePath
       oProcess.Terminate()
       Echo cProcessName & " Killed!"
    End If
Next   
Set oService = Nothing  
____________________________________________________________________

and am looking for some equivalent in xBase++.

Thanks in advance,
Nick Ramoundos
www.e-zschedule.com
Jim LeeRe: Process Location
on Sun, 23 Apr 2017 04:42:36 +0200
> and am looking for some equivalent in xBase++.

http://bb.donnay-software.com/donnay/viewtopic.php?f=15&t=2132

steffen.pirsig
Betreff des Beitrags: Re: FOXPRO TO XBASE++ CONVERSION
10.03.2017, 15:54

---

#include "activex.ch"
PROCEDURE Main()
LOCAL oWMI, colItems
LOCAL aItem, bAdder,j

   oWMI :=
CreateObject("WbemScripting.SWbemLocator" ):ConnectServer("Localhost","Root\CIMv2")
 here Notepad.exe ... all in 1 line
   colItems := oWMI:ExecQuery("select * from Win32_Process where
name='notepad.exe'",,48)

   aItem := {}
   bAdder := {|oService,n| AADD(aItem, oService )}
   ComEvalCollection(colItems, bAdder )

   FOR j:=1 TO Len(aItem)
     aItem[j]:terminate(0)
   NEXT

   oWMI:Destroy()
RETURN
Nick Ramoundos Re: Process Location
on Sun, 23 Apr 2017 17:05:53 +0200
Jim Lee wrote in news:55026811$709b181a$44dd2@news.alaska-software.com:

>> and am looking for some equivalent in xBase++.
> 
> http://bb.donnay-software.com/donnay/viewtopic.php?f=15&t=2132
> 
> steffen.pirsig
> Betreff des Beitrags: Re: FOXPRO TO XBASE++ CONVERSION
> 10.03.2017, 15:54
> 


Thanks Jim.

Requires ASCOM10 LIb and DLL
Do you have a link so I can download.
Can't find these on Alaska's site,

Regards, 
Nick
Nick Ramoundos Re: Process Location - 1 attachment
on Sun, 23 Apr 2017 17:52:33 +0200
See Attachment.

> Thanks Jim.
> 
> Requires ASCOM10 LIb and DLL
> Do you have a link so I can download.
> Can't find these on Alaska's site,
> 
Regards, 
Nick




Win32_Process.jpg
Jim LeeRe: Process Location - 1 attachment
on Sun, 23 Apr 2017 22:54:41 +0200
which Xbase++ Version do you have ?

activeX is include since Xbase++ v1.9x
Nick Ramoundos Re: Process Location - 1 attachment
on Mon, 24 Apr 2017 20:23:53 +0200
Jim Lee wrote in news:a052f9$38929a17$47db5@news.alaska-software.com:

> which Xbase++ Version do you have ?
> 
> activeX is include since Xbase++ v1.9x 
> 
> 
> 

I am Running 1.82 for this particular application but I have 1.9 on another 
station.  If I create a dll in 1.9 with your functions, can I call them 
from 1.82 app?

Nick
Jim LeeRe: Process Location - 1 attachment
on Mon, 24 Apr 2017 22:02:51 +0200
> I am Running 1.82 for this particular application but I have 1.9 on 
> another
> station.  If I create a dll in 1.9 with your functions, can I call them
> from 1.82 app?

NO, you can't mix v1.8x DLL with v1.9x or. v2.x
you can try using Disphelper for COM include in ot4xb

---

i wonder why you want to use WMI ... try this

#define GW_HWNDNEXT     2

   aHandles := GetTaskList( oDlg:GetHwnd( ) )

FUNCTION Gettasklist( hWnd )
LOCAL aList       := {}
LOCAL cWindowName
LOCAL nVisible

   DO WHILE hWnd != 0
      cWindowname := SPACE( 100 )
      IF ( GetWindowTextA( hWnd, @cWindowName, LEN( cWindowName ) ) <> 0 )
         nVisible := IsWindowVisible( hWnd )
         IF nVisible == 1
            AADD( aList, STR( hWnd, 8 ) + cWindowname )
         ENDIF
      ENDIF
      hWnd = GetWindow( hWnd, GW_HWNDNEXT )
   ENDDO
RETURN aList

STATIC FUNCTION GetWindowTextA( hWnd, lPstring, nMax )
LOCAL nDll := DllLoad( "USER32.DLL" )
LOCAL xRet := DllCall( nDll, DLL_STDCALL, "GetWindowTextA", hWnd, @lPstring, 
nMax )
   DllUnLoad( nDll )
RETURN xRet

STATIC FUNCTION IsWindowVisible( hWnd )
LOCAL nDll := DllLoad( "USER32.DLL" )
LOCAL xRet := DllCall( nDll, DLL_STDCALL, "IsWindowVisible", hWnd )
   DllUnLoad( nDll )
RETURN xRet

STATIC FUNCTION GetWindow( hWnd, uCmd )
LOCAL nDll := DllLoad( "USER32.DLL" )
LOCAL xRet := DllCall( nDll, DLL_STDCALL, "GetWindow", hWnd, uCmd )
   DllUnLoad( nDll )
RETURN xRet
Nick Ramoundos Re: Process Location - 1 attachment
on Tue, 25 Apr 2017 15:24:06 +0200
Jim Lee wrote in news:52710e39$76f03b01$4e8a0@news.alaska-software.com:

>> I am Running 1.82 for this particular application but I have 1.9 on 
>> another
>> station.  If I create a dll in 1.9 with your functions, can I call
>> them from 1.82 app?
> 
> NO, you can't mix v1.8x DLL with v1.9x or. v2.x
> you can try using Disphelper for COM include in ot4xb
> 
> ---
> 
> i wonder why you want to use WMI ... try this
> 
> #define GW_HWNDNEXT     2
> 
>    aHandles := GetTaskList( oDlg:GetHwnd( ) )
> 
> FUNCTION Gettasklist( hWnd )
> LOCAL aList       := {}
> LOCAL cWindowName
> LOCAL nVisible
Jim, 

I am sorry that I have not been clear in what I need.
Thanks your for your patience.

Here is what I need:

1. Determine if Application "MYCLIENTAPP.Exe" is running.
2. If "MYCLIENTAPP.Exe" IS RUNNING, return the fully qualified path of the 
App.

Something like this...
______________________________________________________

Procedure FindFixRestart

Local cFullPathname:=Nil
If IsAppRunning("MYCLIENTAPP.Exe",@cFullPathname)
   KillTask("MYCLIENTAPP.Exe")
   /*  Do some maintenance here */
   Restart cFullPathname+"MYCLIENTAPP.Exe"
EndIf
______________________________________________________

Determining if the app is running in xBase++ has been solved.
It's retrieving the fully qualified path of "MYCLIENTAPP.Exe"
that eludes me (in Version 1.82).

Regards and thank you again for trying to assist me.

Nick.