[Done] PureBasic 6.40 alpha 1 Open Save File
[Done] PureBasic 6.40 alpha 1 Open Save File
The IDE include in PB 6.40 alpha 1 (windows x64) crashes on Open or Save File
Last edited by ChrisR on Wed Jan 28, 2026 12:42 pm, edited 1 time in total.
Re: PureBasic 6.40 alpha 1 Open Save File
I don't know if it can helps, but my application compiled with 6.40a1 also crashes on Open(Save)FileRequester, with OnErrorCall, I have:
Error Message: Unknown error code
Source Code File\Line = ProcedureReturn Result (#PB_ProcessPureBasicEvents) in my WinCallback
However, I tried to reproduce it with a simple code using SetWindowCallback() and OpenFileRequester() behind a button, but I cannot reproduce it here!
The rest, generating code with a lot of large string manipulation, seems to work well.
By adding a loop to the code generation to measure speed with a large interface, I go from 9 ms to 7 ms.
Knowing that most concatenations are done using ExString, but a 2 ms gain is always welcome, congrat
Error Message: Unknown error code
Source Code File\Line = ProcedureReturn Result (#PB_ProcessPureBasicEvents) in my WinCallback
However, I tried to reproduce it with a simple code using SetWindowCallback() and OpenFileRequester() behind a button, but I cannot reproduce it here!
The rest, generating code with a lot of large string manipulation, seems to work well.
By adding a loop to the code generation to measure speed with a large interface, I go from 9 ms to 7 ms.
Knowing that most concatenations are done using ExString, but a 2 ms gain is always welcome, congrat
Re: PureBasic 6.40 alpha 1 Open Save File
Could you give me the ErrorCode() value you get when using OpenFileRequester() ?
Re: PureBasic 6.40 alpha 1 Open Save File

Code: Select all
Windows: 11 x64
IceDesign Version: 2.4.2
Source Code File: ObjectTheme.pbi
Source Code Line: 1245 (ProcedureReturn Result (#PB_ProcessPureBasicEvents) in ObjectTheme WinCallback)
Error Code: -529697949
Error Message: Unknown error codeRe: PureBasic 6.40 alpha 1 Open Save File
With PB 6.40 you need to fix all strings modified by API or manual character length changes.
In your WinCallback() there you have GetClassName_() call
Code: Select all
CompilerIf #PB_Compiler_Version >= 640
Procedure ResetStringLength(*s.Character)
Protected *p.Integer = *s -SizeOf(Integer)
*p\i = 0
While *s\c
*p\i + 1
*s + SizeOf(Character)
Wend
EndProcedure
CompilerElse
Macro ResetStringLength(s)
;
EndMacro
CompilerEndIfCode: Select all
Buffer = Space(64)
IF GetClassName_(ParentGadget, @Buffer, 64)
ResetStringLength(@Buffer)Re: PureBasic 6.40 alpha 1 Open Save File
Oh! yes, thanks a lot fryquez and glad to see you around my friend
Well, I couldn't test it right away, I have lots of other space() and strings modified by API elsewhere to correct too.
But that's the right track, indeed, I didn't think beyond the end of my nose.
And thanks also for the ResetStringLength() macro/procedure.
So, there must be something similar in the IDE as well!
Well, I couldn't test it right away, I have lots of other space() and strings modified by API elsewhere to correct too.
But that's the right track, indeed, I didn't think beyond the end of my nose.
And thanks also for the ResetStringLength() macro/procedure.
So, there must be something similar in the IDE as well!
Re: PureBasic 6.40 alpha 1 Open Save File
Thanks for the error code, should be fixed for the next alpha
Re: [Done] PureBasic 6.40 alpha 1 Open Save File
It looks good for the IDE and my app with PB 6.40 alpha2, thanks 
Re: [Done] PureBasic 6.40 alpha 1 Open Save File
most of the windows API functions if not all that set a string length either return the length or set a variable with the length
so you could poke the length without having to parse the string.
Whether this would be safe depends If Fred uses any of the MSB for flags on the length variable but that would limit strings to 1gb on x86 unless the structure on x86 was extended with a quad for length.
I'll wait and see!
so you could poke the length without having to parse the string.
Code: Select all
PureBasicPath$ = Space(#MAX_PATH)
len = GetModuleFileName_(GetModuleHandle_(#Null$), @PureBasicPath$, #MAX_PATH)
If Len > 0
Debug PeekL(@PureBasicPath$-8)
PokeI(@PureBasicPath$-8,len)
Debug Len(PureBasicPath$)
Debug PureBasicPath$
EndIf
Whether this would be safe depends If Fred uses any of the MSB for flags on the length variable but that would limit strings to 1gb on x86 unless the structure on x86 was extended with a quad for length.
I'll wait and see!
Re: [Done] PureBasic 6.40 alpha 1 Open Save File
Yep, -SizeOf(Integer), I'll wait and see too!
See also, ReplaceCharNewLen() here, without API. Without resetting the len in the loop, PeeKS() must then be called after the procedure, with a second loops then.
Any procedures on string with a loop per character that modify the final length will be in the same situation, with the length managed internally in the loop or using PeeKS afterward.
See also, ReplaceCharNewLen() here, without API. Without resetting the len in the loop, PeeKS() must then be called after the procedure, with a second loops then.
Any procedures on string with a loop per character that modify the final length will be in the same situation, with the length managed internally in the loop or using PeeKS afterward.



