04140224.txt 14-Apr-00


Application is Running

From vorio@rio.com.br Thu Mar 16 10:29:35 2000

Hello all!

I need to know about if another application is running.
An exemple:  I need to know if "Winfax" is running.  In
negative case I will launch it via app:exec()
In API16 I know how to do this, but in API32  not.

If you can help me...
Thanks

Lucio Chiessi

From nswong@my-deja.com Thu Mar 16 10:55:49 2000

Hi Lucio,

An idea, may not work. Try to open the Winfax.exe as
EXCLUSIVE, if that Winfax.exe are already running, due to OS
may perform binary code sharing or application may do
overlaying, FOpen() should fail.

Regards,
Wong


From squinn@brutecom.com.au Thu Mar 16 12:23:38 2000

Lucio

Wouldn't printing to the FAX device start it up
automatically??

You could use a Windows SPY program to find out the Winfax
internal name/Top most window name/Title and use that in
your app with FindWindow().

Have you tried looking through the WINFAX API from
Symantec??

--
HTH
Steve Quinn

From richard.dandoroff@forestresearch.co.nz Thu Mar 16
12:43:56 2000

You can use FindWindow (API), though you may need to know
the class name of Winfax,
OR,
EnumWindows (API)- requires you to supply a callback
function.  With EnumWindows your callback fcn get called
once for every app running on the PC, with the windows
handle passed as a parameter. Once you have the handle you
can get the Window caption, and if you know what string or
substring to look for (ie "Winfax" ) - you can see if Winfax
is running.

HTO
Richard.
From rdd30700@mail.telepac.pt Fri Mar 17 17:12:22 2000

Lucio,

I'm using GetModuleHandle() both in 16 and 32 bits...

Cumprimentos

Adriano


From nswong@my-deja.com Fri Mar 17 18:07:47 2000

Hi Adriano,

You test this under what version of Windows?

I had tried long time ago under Win95, the result show
GetModuleHandle() cannot check modules loaded by other
process, not even can check modules loaded at start up by
Windows but use by current process.

Regards,
Wong


From rdd30700@mail.telepac.pt Fri Mar 17 22:26:54 2000

Wong,

I'm using this under W95/W98, for example to check if Word
is allready running.... This works perfectly on 16bits and
in the current porting to 32bits I'm still using
GetmoduleHanlde() with no problems.

However, let me confirm...

Adriano

From nswong@my-deja.com Fri Mar 17 23:59:49 2000

Hi Adriano,

I just tested by running Try.exe first, then follow by
Test.exe. Even though Try.exe still running, but Test.exe
cannot detect it.

Try.exe //Result =="ptrModule!=NULL_PTR"
------------
PROCEDURE Start()
  LOCAL ptrModule AS PTR, cMessage AS STRING
  ptrModule:=GetModuleHandle(String2Psz("Try.exe"))
  cMessage:=IIf(ptrModule==NULL_PTR,"ptrModule==NULL_PTR",;
    "ptrModule!=NULL_PTR")
  MessageBox(NULL,String2Psz(cMessage),;
    String2Psz("Try.exe"),0)
RETURN

Test.exe //Result =="ptrModule==NULL_PTR"
-------------
PROCEDURE Start()
  LOCAL ptrModule AS PTR, cMessage AS STRING
  ptrModule:=GetModuleHandle(String2Psz("Try.exe"))
  cMessage:=IIf(ptrModule==NULL_PTR,"ptrModule==NULL_PTR",;
    "ptrModule!=NULL_PTR")
  MessageBox(NULL,String2Psz(cMessage),;

    String2Psz("Test.exe"),0)
RETURN

Actually I hope this will work, so I don't need to write
long rounded program to do it. :-)

Regards,
Wong


From rdd30700@mail.telepac.pt Sat Mar 18 02:49:53 2000

Wong,

You're absolutelly rigth... Bad testing procedures led me to
think it was working fine... As a matter of fact this issue
is buried deep on my to-do list for this app... My brain is
malfunctioning ;)

Lucio, please forgive me a "dica tola"...

Adriano


From vorio@rio.com.br Tue Mar 21 01:06:32 2000

Hello to all...

Thanks a lot.

    Source: geocities.com/n_s_wong/vo/ng

               ( geocities.com/n_s_wong/vo)                   ( geocities.com/n_s_wong)