PDA

View Full Version : Sending messages



NewsArchive
05-01-2009, 04:18 AM
Friedrich,

Is there a function to send a message (aka Clarion event) to a running
application? For example, something along these lines:

Loop
Set Variable %MYAPPACTIVE% to FUNCTION:Detect Active
Application(MyApp.exe)
If %MYAPPACTIVE% Equals "1" Then
Send Message "%MSG_CloseDown%"
Wait(20)
Cycle Loop
Else
Break Loop
End
End

This detects if the application is running, if so send it a message, which
MyApp detects a user event and sends itself an EVENT:CloseDown. The Loop
waits a certain interval then cycles. It should be the app's responsibility
to clean up stuff when closing down, like saving pending writes, etc. Thus
the Cycle Loop to give the app enough time to close.

--
Russell B. Eggen
www.radfusion.com
Clarion developers: www.radfusion.com/dev.htm

NewsArchive
05-01-2009, 04:18 AM
Doesn't Nettalk have something like this?

paul macfarlane

NewsArchive
05-01-2009, 04:19 AM
NetTalk does installs?

--
Russell B. Eggen
www.radfusion.com
Clarion developers: www.radfusion.com/dev.htm

NewsArchive
05-01-2009, 04:19 AM
Sorry - read the message but not the group..<g>

paul macfarlane

NewsArchive
05-01-2009, 04:20 AM
Have you played with the "mailslots" demo stuff in vuFileTools? He
manipulates and closes down one app from within another one.

Jane

NewsArchive
05-01-2009, 04:20 AM
Nope - don't have that tool. Larry's reply pretty much aligns with what I
was thinking. Appreciate the response.

--
Russell B. Eggen
www.radfusion.com
Clarion developers: www.radfusion.com/dev.htm

NewsArchive
05-01-2009, 04:21 AM
FWIW you could just call SendMessage() from Setup Builder. I've called
Windows API functions before. It's in the documentation, look at Call DLL
Function.

Larry Sand

NewsArchive
05-01-2009, 04:21 AM
Thanks Larry. The obvious stuff can hide in plain sight <G>.

--
Russell B. Eggen
www.radfusion.com
Clarion developers: www.radfusion.com/dev.htm

NewsArchive
05-01-2009, 04:22 AM
Hi Larry, Russ,

> FWIW you could just call SendMessage() from Setup Builder. I've called
> Windows API functions before. It's in the documentation, look at Call DLL
> Function.

Or if that doesn't work for this particular api, you can create a dll in
Clarion to do it and call it from SB. Would you need to subclass the frame
in order for it to respond to WM_Close? I would presume it does so
automatically just like you posted EVENT:Close to it?

Best regards,

--
Arnór Baldvinsson - Icetips Alta LLC
Port Angeles, Washington
www.icetips.com - www.buildautomator.com

Icetips product subscriptions at http://www.icetips.com/subscribe.php

NewsArchive
05-01-2009, 04:22 AM
Russ,

The "standard" way is to send a WM_Close to the application. The "Teminate
Active Application..." with an enabled "Gently Close Application" option
does this for you.

And of course, the other suggestions would also work: calling SendMessage or
using an external DLL.

Does this help?

Friedrich

NewsArchive
05-02-2009, 01:29 AM
I'll have to check into the Terminate Active App with the enabled Gently
Close Application option.

--
Russell B. Eggen
www.radfusion.com
Clarion developers: www.radfusion.com/dev.htm