How to supress Messages?

We are currently calling a Clarion exe from a .NET backend, the problem is that the exe shouldn’t throw any messages.

If an error occur on the Clarion side, an exception for example, or just a simple message, it will pop up a message on the screen and freeze the app, because there is no user actually using it, it is just being called by the .NET code.

I need a way to supress all the messages, or maybe a better approach than this one.

Look at prop:messageHook in the help. You’ll also want to look at prop:AssertHook and prop:StopHook, since Assert and Stop can also popup a window. Also, If you have MessageBox from Capesoft, you can use that to accomplish what you want.

1 Like

So, with Prop:MessageHook I can set my own custom Message window?

Do you have any resources about it? I didn’t found anything usefull on the Clarion Docs

It worked, thanks!!!

Just need to create a function with the same signature of the message

System{Prop:MessageHook} = Address(MessageTest)

MessageTeste FUNCTION(STRING MessageTxt,<STRING HeadingTxt>,<STRING IconSent>,<STRING ButtonsPar>,UNSIGNED MsgDefaults=0,BOOL StylePar=FALSE),LONG
 CODE
1 Like

You can also hook STOP and HALT in case those occur.

Also PrinterDialog, FileDialog, ColorDialog and FontDialog!

Good idea. Write some kind of log and RETURN False.

Best to build Debug and use the Debug\ClaRun.DLL so you can get a call stack, then before the “RETURN False” do an ASSERT(0,'Program attempted PrinterDialog()'). Implement PROP:AssertHook2 to capture that info.

You could also look at SYSTEM{PROP:LastChanceHook} and LibSrc\CwExcpt.int. When any GPF or an RTL Debug Check (e.g. Array Index) occurs it will call your function before the dialog is show. You can use the Interface to log the Exception to a file and close without user interaction.

I covered it some at one the the CIDC’s. It might be covered in the Help. There are some blog posts:

I would have suggested Capesoft messageBox It does all that for you and also adds logging etc.
I use it for just about everything. Especially good for services, You just check the options for a timeout and set the timeout to .1 of a sec