Posted: Wed Oct 10, 2007 12:57 pm
Would you mind, when you've time, trying it on Win NT. It should run okay.
Thanks.
Thanks.
http://www.purebasic.com
https://www.purebasic.fr/english/
Just tried (NT4 sp6 fr) : it crashed.srod wrote:Would you mind, when you've time, trying it on Win NT. It should run okay.
Immediately after I started it.srod wrote:Hi,
did it crash immediately on running?
1. If English.nxScribelan is in the EXE directory, no error.srod wrote:Right, my orginal suspicion!
The following zip contains just the short procedure which is throwing the error.
If you unzip the two files within to a folder and run the LoadLanguageFile.pbi program you should see exactly where the crash occurs.
Thanks I really appreciate your help here.
http://www.purecoder.net/nxScribeLanguage.zip
Code: Select all
;'nxScribe'.
;===========
;Language file module.
Global Dim gLanguage$(0)
Enumeration ;Language strings.
#lan_application
#lan_author
#lan_builddate
#lan_language
#lan_Error
#lan_Terminating
#lan_GUIProblem
#lan_DuplicateIdentifier
#lan_NoGroupSpaces
#lan_NoIdentifierSpaces
#lan_FileNotFound
#lan_LanguageFile
#lan_AbortingProcedure
#lan_ttNewProject
#lan_ttOpenProject
#lan_ttSaveProject
#lan_ttSaveProjectAs
#lan_ttChangeSettings
#lan_ttLanguageFiles
#lan_ttGenerateSource
#lan_ttCloseProject
#lan_ttHelp
#lan_ttExit
#lan_ttShiftLeft
#lan_ttShiftRight
#lan_ttContextMenus
#lan_ttClickHeader
#lan_ttRemoveSelectedLanguages
#lan_ttAddRow
#lan_menuAddRow
#lan_menuInsertRowBefore
#lan_menuInsertRowAfter
#lan_menuDeleteRow
#lan_menuCutRow
#lan_menuCopyRow
#lan_menuPasteNewRow
#lan_gdLanguages
#lan_gdAdd
#lan_gdEdit
#lan_gdDelete
#lan_gdGroups
#lan_gdNoLanguageGroup
#lan_gdSelectedGroup
#lan_gdSelectedGroupEntry
#lan_gdSelectedGroupEntries
#lan_gdIdentifier
#lan_gdAddRow
#lan_gdCreateLanguageFiles
#lan_gdLanguagesFrame
#lan_gdAvailableLanguages
#lan_gdLanguageFilesToCreate
#lan_gdLanguageFileFormat
#lan_gdDestinationFolder
#lan_gdCancel
#lan_gdCreateFiles
#lan_CloseCurrentProject
#lan_NewGroupName
#lan_GroupNewName
#lan_GroupNameExists
#lan_OutOfMemory
#lan_DeleteGroup
#lan_DeleteRow
#lan_NewLanguageName
#lan_LanguageNewName
#lan_LanguageExists
#lan_DeleteLanguage
#lan_ProjectHasChanged
#lan_SelectSaveLocation
#lan_FileAlreadyExists
#lan_SelectProjectToOpen
#lan_ProblemOpeningProject
#lan_InvalidProjectFile
#lan_NoProjectOpen
#lan_NoLanguages
#lan_SelectAtLeastOneLanguage
#lan_Module
#lan_CreatedBy
#_languagfileeend
EndEnumeration
;Returns non zero if no error.
Procedure.l LoadLanguageFile()
Define blnTemp, languagefilename$, temp$, i, result, fileformat
Dim gLanguage$(#_languagfileeend-1)
;We need to scan the current directory looking for language files.
;If there are some, then we select the first found.
;Else, we unpack the default language file to a temporary location.
If ExamineDirectory(1,GetPathPart(ProgramFilename()),"*.nxScribelan")
If NextDirectoryEntry(1)
languagefilename$=DirectoryEntryName(1)
EndIf
EndIf
FinishDirectory(1)
If languagefilename$=""
languagefilename$=GetTemporaryDirectory()+"English.nxScribelan"
If CreateFile(1,languagefilename$)
blnTemp = #True ; Signify that we will have to delete the temporary file.
WriteData(1,?englanstart,?englanend-?englanstart)
CloseFile(1)
EndIf
Else
languagefilename$=GetPathPart(ProgramFilename())+languagefilename$
EndIf
;Now we need to load the language file into the language$ array,
If ReadFile(1, languagefilename$)
;Determine the format of the file.
fileformat=ReadStringFormat(1)
If fileformat<=#PB_Ascii ;Recongnised format.
While Not(Eof(1))
temp$=Trim(ReadString(1, fileformat))
If temp$<>"" And Left(temp$,1)<>";"
gLanguage$(i)=temp$
i+1
EndIf
Wend
result = 1
EndIf
CloseFile(1)
EndIf
If blnTemp
DeleteFile(languagefilename$)
EndIf
ProcedureReturn result
EndProcedure
;-Data section.
;******************************************************************************************
DataSection
englanstart:
IncludeBinary "English.nxScribelan"
englanend:
EndDataSection
LoadLanguageFile()
MessageRequester("",gLanguage$(1))I compile 'LoadLanguageFile.pbi' without error (IncludeBinary works as English.nxScribelan is in the pbi's directory).srod wrote:Gnozal if I remove the lan file from the exe directory then the program crashes because of the IncludeBinary() statement, which makes sense because of the missing file. This is of course a compilation error rather than a runtime one.
The fact that on your system it crashes at a different point, at run time, indicates a problem with Win NT or PB itself.
This is strange.
Yessrod wrote:I presume you've compiled with the debugger enabled?
Code: Select all
If ExamineDirectory(1,GetPathPart(ProgramFilename()),"*.*")
While NextDirectoryEntry(1)
If LCase(GetExtensionPart(DirectoryEntryName(1))) = "nxscribelan"
languagefilename$=DirectoryEntryName(1)
Break
EndIf
Wend
FinishDirectory(1)
EndIf
Code: Select all
;'nxScribe'.
;===========
;Language file module.
Global Dim gLanguage$(0)
Enumeration ;Language strings.
#lan_application
#lan_author
#lan_builddate
#lan_language
#lan_Error
#lan_Terminating
#lan_GUIProblem
#lan_DuplicateIdentifier
#lan_NoGroupSpaces
#lan_NoIdentifierSpaces
#lan_FileNotFound
#lan_LanguageFile
#lan_AbortingProcedure
#lan_ttNewProject
#lan_ttOpenProject
#lan_ttSaveProject
#lan_ttSaveProjectAs
#lan_ttChangeSettings
#lan_ttLanguageFiles
#lan_ttGenerateSource
#lan_ttCloseProject
#lan_ttHelp
#lan_ttExit
#lan_ttShiftLeft
#lan_ttShiftRight
#lan_ttContextMenus
#lan_ttClickHeader
#lan_ttRemoveSelectedLanguages
#lan_ttAddRow
#lan_menuAddRow
#lan_menuInsertRowBefore
#lan_menuInsertRowAfter
#lan_menuDeleteRow
#lan_menuCutRow
#lan_menuCopyRow
#lan_menuPasteNewRow
#lan_gdLanguages
#lan_gdAdd
#lan_gdEdit
#lan_gdDelete
#lan_gdGroups
#lan_gdNoLanguageGroup
#lan_gdSelectedGroup
#lan_gdSelectedGroupEntry
#lan_gdSelectedGroupEntries
#lan_gdIdentifier
#lan_gdAddRow
#lan_gdCreateLanguageFiles
#lan_gdLanguagesFrame
#lan_gdAvailableLanguages
#lan_gdLanguageFilesToCreate
#lan_gdLanguageFileFormat
#lan_gdDestinationFolder
#lan_gdCancel
#lan_gdCreateFiles
#lan_CloseCurrentProject
#lan_NewGroupName
#lan_GroupNewName
#lan_GroupNameExists
#lan_OutOfMemory
#lan_DeleteGroup
#lan_DeleteRow
#lan_NewLanguageName
#lan_LanguageNewName
#lan_LanguageExists
#lan_DeleteLanguage
#lan_ProjectHasChanged
#lan_SelectSaveLocation
#lan_FileAlreadyExists
#lan_SelectProjectToOpen
#lan_ProblemOpeningProject
#lan_InvalidProjectFile
#lan_NoProjectOpen
#lan_NoLanguages
#lan_SelectAtLeastOneLanguage
#lan_Module
#lan_CreatedBy
#_languagfileeend
EndEnumeration
;Returns non zero if no error.
Procedure.l LoadLanguageFile()
Define blnTemp, languagefilename$, temp$, i, result, fileformat
Dim gLanguage$(#_languagfileeend-1)
;We need to scan the current directory looking for language files.
;If there are some, then we select the first found.
;Else, we unpack the default language file to a temporary location.
If ExamineDirectory(1,GetPathPart(ProgramFilename()),"*.*")
While NextDirectoryEntry(1)
If GetExtensionPart(DirectoryEntryName(1)) = ".nxScribelan"
languagefilename$=DirectoryEntryName(1)
Break
EndIf
Wend
FinishDirectory(1)
EndIf
If languagefilename$=""
languagefilename$=GetTemporaryDirectory()+"English.nxScribelan"
If CreateFile(1,languagefilename$)
blnTemp = #True ; Signify that we will have to delete the temporary file.
WriteData(1,?englanstart,?englanend-?englanstart)
CloseFile(1)
EndIf
Else
languagefilename$=GetPathPart(ProgramFilename())+languagefilename$
EndIf
;Now we need to load the language file into the language$ array,
If ReadFile(1, languagefilename$)
;Determine the format of the file.
fileformat=ReadStringFormat(1)
If fileformat<=#PB_Ascii ;Recongnised format.
While Not(Eof(1))
temp$=Trim(ReadString(1, fileformat))
If temp$<>"" And Left(temp$,1)<>";"
gLanguage$(i)=temp$
i+1
EndIf
Wend
result = 1
EndIf
CloseFile(1)
EndIf
If blnTemp
DeleteFile(languagefilename$)
EndIf
ProcedureReturn result
EndProcedure
;-Data section.
;******************************************************************************************
DataSection
englanstart:
IncludeBinary "English.nxScribelan"
englanend:
EndDataSection
LoadLanguageFile()
MessageRequester("",gLanguage$(1))