esgici wrote:Hi All
This study has taught me something important: I'm an incorrigible windbag
I sent more than 3600 posts in six years.whereas I have only a half contribution recorded ( not even one, because together with a colleague )
Please look at this : I never wrote anything as valuable at least as this (never called) function :
Code: Select all
FUNCTION HTML_END( HTMARCH )
FWrite( HTMARCH, "</BODY></HTML>" )
FClose( HTMARCH )
Return Nil
Please don't understand wrong; I haven't any problem with anyone, any way, any meaning; especially with forum management.
I want only criticize myself.
Happy HMG'ing

Hi Esgici, I do not understand why you mix different matters at one topic which has not relative.... but anyway I will answer your question:
First you need to read this:
http://hmgforum.com/viewtopic.php?p=34099#p34099, probably you missed it or you have not understood.
Actually in C:\hmg.3.2\SOURCE\h_error.prg there is a function which is very used called MsgHMGError (as I already said in mentioned topic). This function also calls a HTML_ERRORLOG function which is responsable to open
or/and creates a new file ErrorLog.Htm at current folder when any error is triggering.
By the normal rule. When you open one file and especially when it is being created, is necessary to close it before opening for other proposes. As is it in last line of MsgHMGError which is opening by ShowError function.
Even you seing apparently unusuable the function HTML_END. I've tried to ilustrate what is needed for a complete routine in MsgHMGError and also let this function for generic use in any html demmands. You can see at C:\hmg.3.3.1\SOURCE\h_HMG_HPDF.Prg in _hmg_hpdf_enddoc function I've used this HTML_END function but I've changed for two lines containing ending of TABLE when lDoLog is true.
You also could ask but why any error is not being to happen without close file ?
And I tell you: it is because normally is being close previously the app when is in error using ExitProcess(0) but in the right way IMO when is opening a file must be closed previously, this is the right think.
Please see this sample:
Code: Select all
#include <hmg.ch>
Function Main
MsgHMGError("This is a test")
MsgInfo("This second message is not be displayed...")
Return Nil
But if you try to do this:
Code: Select all
#include <hmg.ch>
Function Main
Local HtmArch
If .Not. File("c:\"+CurDir()+"\My_Report.htm")
HtmArch := FCreate( "c:\"+CurDir()+"\My_Report.htm" )
Html_Line(HtmArch)
Else
HtmArch := FOPEN("c:\"+CurDir()+"\My_Report.htm",2)
FSeek(HtmArch,0,2) //End Of File
Endif
Html_LineText(HtmArch,"This is a test being saved at "+Html_Bold(HtmArch,"My_Report.htm")+" file. "+Dtoc(Date())+" "+"Time: "+Time())
Html_LineText(HtmArch, HMGVersion())
Html_Line(HtmArch)
Html_End(HtmArch) // <- Try with new test disabling this line
Other_Proccess()
Execute File("c:\"+CurDir()+"\My_Report.htm")
Return Nil
Function Other_Proccess()
Local File_Handle := FOPEN("c:\"+CurDir()+"\My_Report.htm",2)
FSeek(File_Handle,0,2) //End Of File
FWrite(File_Handle, "Second process"+ "<BR>"+CHR(13)+CHR(10))
Html_Line(File_Handle)
Html_End(File_Handle)
Return Nil
This test is gonna creates a htm file with two process but if you try for example, with disabling the 18th line,then you will see the second process is not be allowed (not recorded).
You probably did not used yet html functions deeply but this does means that should it not exists for whom can make use of it.
Right
I would like to see all HTML functions gathered in one source file just to understand all HMTL features in HMG. For example, all HMTL function in C:\hmg.3.3.1\SOURCE\h_HMG_HPDF.Prg. At the time to create a new function be called
Html_Table_End for tables proposes.
And also be corrected to add
Html_End at source of MsgHMGError function.
Thank you Esgici to advice us the lack of use of Html_End (but still I think should it have it).
