xsharp.eu • Problem in Executable, but not from IDE
Page 1 of 2

Problem in Executable, but not from IDE

Posted: Thu Nov 07, 2019 8:02 am
by Anonymous
I get the following error sometimes when using my program as an .exe. The same code runs fine without any problem when run from within the VO WED. Any ideas where I even start to look please?
Capture.JPG
Capture.JPG (21.97 KiB) Viewed 386 times

Problem in Executable, but not from WED

Posted: Thu Nov 07, 2019 8:23 am
by wriedmann
Hi Jeff,
please check the opened DLLs.
The exe may be started from another location than from the IDE.
Wolfgang

Problem in Executable, but not from WED

Posted: Sat Nov 16, 2019 12:33 pm
by BiggyRat
Hi Wolfgang, I've been all over the program, got rid of absolutely everything that isn't needed, even removed everything fron the start() method except the initialize, and exec statements, and it still happens. All I need to do is start the program, and hit the exit button. Do nothing else, and 95% of the time the error occurs.

Does this give anyone any clues?

Start Method()

method Start() class App
local oMainWindow as ShellWindow
Local cWorkDir, cPath as String
Local cHelpFile := WorkDir() +"; "+ WorkDir()+"Invoices" + "; "+ WorkDir()+"BizHelp" as String
VODBRddSetDefault("DBFCDX")
cWorkDir := WorkDir()
cPath := cWorkDir +"; "+ cWorkDir+"Invoices" + "; "+ cWorkDir+"BizHelp"
SetPath(cPath)
SetNatDLL("BRITISH")
SetDateCountry ( BRITISH )
SetDateFormat("dd/MM/yyyy")
SetCentury(true)
SetAmPm(false)
SetThemeAppProperties(_or(STAP_ALLOW_NONCLIENT, STAP_ALLOW_CONTROLS, STAP_ALLOW_WEBCONTENT))
SetExclusive(FALSE)
SetDeleted(true)
self:SetGlobalValues()
Run("FixOutlook2016.reg")
self:Initialize()
oMainWindow := ShellWindow{self}
oMainWindow:Caption := cAppVersion
oMainWindow:Icon := BM{}
oMainWindow:IconSm := BM{}
oMainWindow:EnableSystemMenu(FALSE)
oMainWindow:HelpDisplay := HelpDisplay{"BizMan.CHM" }
oMainWindow:HelpDisplay:EnableHTMLHelp(true)
SetInternational(#Clipper)
oMainWindow:Show(SHOWZOOMED)
MainMenu{}:Show(SHOWCENTERED)
self:Exec()

Return self



Exit Button.

METHOD ExitButton( ) CLASS MainMenu
Local oTb as TextBox
Local oDb as DBServer
oDb := DbServer{"BACKUPS"}
oDb:SetOrder("BACKUPS", "BACKUPS")
oDb:GoTop()
IF !oDb:Seek(Today()-7)
oTb := TextBox{self, cAppVersion, "It appears your last backup was over 7 days ago. Would you like to backup now?"}
oTb:TYPE := BOXICONQUESTIONMARK + BUTTONYESNO

IF (oTb:Show() = BOXREPLYYES)
self:BackUpButton()
ENDIF
endif
oDb:Close()
Close All
oTb := TextBox{self, cAppVersion, "Do you really want to quit?"}

oTb:TYPE := BOXICONQUESTIONMARK + BUTTONYESNO

IF (oTb:Show() = BOXREPLYYES)
self:Destroy()
App{}:Quit()
ENDIF
return self


Note, this error was playing up well before any mention of BACKUP, which I only implemented today...


Thanks again for any light you may be able to shed...

Problem in Executable, but not from WED

Posted: Sat Nov 16, 2019 3:06 pm
by wriedmann
Hi Jeff,

can you give us an AEF from this application so we can try it?
Wolfgang

Problem in Executable, but not from WED

Posted: Sat Nov 16, 2019 11:36 pm
by BiggyRat
Certainly. Thanks very much Wolfgang.

Problem in Executable, but not from WED

Posted: Sun Nov 17, 2019 7:45 am
by wriedmann
Hi Jeff,
I had to remove a LOT of code to make compile the code on my system, since you had a lot of libraries included.
But now the application compiles and runs on my PC, both from the IDE and the Exe itself.
Do you are really using the old Report Classes (based on CA-RET)?
In my machine the relative DLLs are missing, so I think they are not even delivered with VO 2.8.
Wolfgang

Problem in Executable, but not from WED

Posted: Sun Nov 17, 2019 8:07 am
by BiggyRat
Hi Wolfgang, no I've never used ca-ret, only ever ReportPro. What am I linking in that involves ca-ret? Report classes I'm assuming. I've removed it. and it's still happening. this time took 7 open and closes...

Problem in Executable, but not from WED

Posted: Sun Nov 17, 2019 9:21 am
by Karl-Heinz
Hi Jeff,

a note about your ExitButton() code:

Line: App{}:Quit()
Are you aware of that you create a *new* App Object ? Use GetAppObject() as described below instead..

Code: Select all

METHOD ExitButton( ) CLASS MainMenu

...     			
...

oTb := TextBox{self, cAppVersion, "Do you really want to quit?"}

oTb:TYPE := BOXICONQUESTIONMARK + BUTTONYESNO

IF (oTb:Show() = BOXREPLYYES)

//	self:Destroy()                 // <-------deactivate the line

//	App{}:Quit()			// <------deactivate the line

	GetAppObject():Quit()          // <---- add this line 
	
ENDIF
return self

regards
Karl-Heinz

Problem in Executable, but not from WED

Posted: Sun Nov 17, 2019 9:27 am
by BiggyRat
Now that's very interesting, thank you Karl-Heinz. I did think that was the case, but I just followed the help files and old habits.

I've implemented the change, but sadly it still played up...

Problem in Executable, but not from WED

Posted: Sun Nov 17, 2019 9:57 am
by Karl-Heinz
Hi Jeff,

Code: Select all

...
oDb:Close()
Close All      // <-------??? ------------
oTb := TextBox{self, cAppVersion, "Do you really want to quit?"}
---
why do you need the "Close All" ? This command will always be executed, regardless of whether the app should shut down or not ?

regards
Karl-Heinz