codesamples:exception_handling_program_startup
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
codesamples:exception_handling_program_startup [2024/09/16 04:40] – wolfgangriedmann | codesamples:exception_handling_program_startup [2024/09/16 09:06] (current) – wolfgangriedmann | ||
---|---|---|---|
Line 7: | Line 7: | ||
class XStartupCode | class XStartupCode | ||
[STAThreadAttribute]; | [STAThreadAttribute]; | ||
- | static method Start as void | + | static method Start() as void strict |
local oSB as System.Text.StringBuilder | local oSB as System.Text.StringBuilder | ||
try | try | ||
- | Functions.Start() | + | |
catch oEx as Exception | catch oEx as Exception | ||
Line 29: | Line 29: | ||
Output( oSB, " | Output( oSB, " | ||
Output( oSB, "Press Return to close the application" | Output( oSB, "Press Return to close the application" | ||
- | | + | |
MessageBox( 0, oSB: | MessageBox( 0, oSB: | ||
System.IO.File.AppendAllText( System.IO.Path.Combine( AppDomain.CurrentDomain: | System.IO.File.AppendAllText( System.IO.Path.Combine( AppDomain.CurrentDomain: | ||
Line 40: | Line 40: | ||
oSB: | oSB: | ||
Console.WriteLine( cText ) | Console.WriteLine( cText ) | ||
- | |||
- | return | ||
- | |||
- | static method Wait() as void | ||
- | |||
- | Console.ReadLine() | ||
return | return | ||
Line 73: | Line 67: | ||
< | < | ||
- | To explain the code | + | To explain: since the GUI can be not yet started when an exception is occurring, the console mode needs to be activated so the error can be shown even with no GUI (and written to a file for later evaluation). |
codesamples/exception_handling_program_startup.1726461618.txt.gz · Last modified: 2024/09/16 04:40 by wolfgangriedmann