Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use Log in standalone app (in C++)
#1
Basically I can't work out how to write messages to the stand-alone app 'Log' window. In essence it should be simple. There should be a 'Log (message)' function, but I can't find it.

I am using IW 14.2.7 Ultimate

Here are references I have found to the Log function:


In to the Delphi example (under OnAfterDispatch: TOnDispatch) on this page:

http://docs.atozed.com/docs.dll/Classes/...rBase.html

There should be a function Log (msg)  that can be used.  But Log is a data member / parameter in this class not a function.



In the 'intraweb manual'  (pg 118) http://downloads.atozed.com/intraweb/IntrawebManual.pdf


Writing custom messages to the debug area 
To write your custom messages in the debug area you may use the method "Log" of the StandAlone window. In Intraweb for Delphi, the default StandAlone window is of type TFormIWMain and is declared in the unit IWMain. In Intraweb for Visual Studio .NET the default StandAlone window is of type Main declared in the Atozed.Intraweb.NETMain namespace. The "Log" method takes a parametter AMsg of type string, which represents the message to be written in the debug area. 

But there is no TFormIWMain class in the C++ app that I can find - or unit IWMain
Reply
#2
Have you looked at the custom stand alone demo?

"There should be a function Log (msg) that can be used"

Its not a function because most deployment methods have no log window at all. The SA window is external to IW, its just a GUI application that uses IntraWeb, it is not part of the IntraWeb core run time.
Reply
#3
Hi Ian, in Uses, put: IWMain;

FormIWMain.Log( 'your log message' );
Reply
#4
@JNPSoftware: thank you

Translating that to C++

#include "IWMain.hpp"

FormIWMain->Log ("My message") ;


@kudzu: It's very difficult for C++ builder users to make sense of Delphi samples. We can't load the projects in the IDE, we can only look at individual source files. But there is no Log function in the sample. There is a IWStandAloneServer1DebugLog function which is what I presume you meant.
Reply
#5
As C++ users are less than 5% compared to Delphi at 95%, we like many vendors support C++ users but have limited demos and documentation for it.

In the EMBT C++ world, Delphi is a must to be able to read as even the VCL is written in Delphi.

That being said, there used to be a standalone demo in C++ but I'm not sure if it still exists in the repository.

Use of FormIWMain.Log is what you want but it comes with a caveat. You are now static linking to the UI form and your application can no longer be deployed as ISAPI or ASPX as long as that static link exists.
Reply
#6
Hi Ian, sorry i don't pay attention is C++, my bad. I use a IFDEF in Delphi, maybe work on C++ too.
Code:
  {$IFDEF DEBUG}
  FormIWMain.Log( '' );
  {$ENDIF}
When is to deploy i compile in Release mode.
Reply
#7
(04-06-2018, 09:01 PM)JNPSoftware Wrote: Hi Ian, in Uses, put: IWMain;

FormIWMain.Log( 'your log message' );

Howdy Ian!

As a C++ user for over 20 years, I would recommend (if you haven't already figured out), you should be paying a little extra and purchasing Rad Studio. 

That way you will get the most out of C Builder by:

1) Being able to use Rad Studio with Delphi projects for building / viewing.

2) Large library of examples if needed.

All the best,

Shane
Reply
#8
(04-08-2018, 12:43 PM)ShaneStump Wrote:
(04-06-2018, 09:01 PM)JNPSoftware Wrote: Hi Ian, in Uses, put: IWMain;

FormIWMain.Log( 'your log message' );

Howdy Ian!

As a C++ user for over 20 years, I would recommend (if you haven't already figured out), you should be paying a little extra and purchasing Rad Studio. 

That way you will get the most out of C Builder by:

1) Being able to use Rad Studio with Delphi projects for building / viewing.

2) Large library of examples if needed.

All the best,

Shane
Hi Shane, 

Yup, I'm a cheapskate though, and I have managed with just C++ Builder for more than 20 years!

You can actually add Delphi units to a C++ project, view the forms and compile them. You just don't get to be able to load Delphi projects, so tend to run into link (library) issues. I usually manage to understand Delphi source.

Ian

(04-08-2018, 12:01 PM)JNPSoftware Wrote: Hi Ian, sorry i don't pay attention is C++, my bad. I use a IFDEF in Delphi, maybe work on C++ too.
Code:
  {$IFDEF DEBUG}
  FormIWMain.Log( '' );
  {$ENDIF}
When is to deploy i compile in Release mode.

Yup thanks, I do that.
Reply
#9
ian@archsw.com - you can use any user name you want within reason.. but you used your email as your username which may cause spammers to find your email address....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)