The getfilename procedure I have been using was placed on the forum by Kristopher Windsor.srvaldez wrote: ↑Jun 17, 2021 11:17 hello FB developers
... [lines of code omitted]
#define WIN_INCLUDEALL
#Include "windows.bi"
...
'===============================================
'===============================================
Sub getfilename()
Dim ofn As OPENFILENAME
Dim filename As Zstring * MAX_PATH+1
With ofn
.lStructSize = sizeof( OPENFILENAME )
.hwndOwner = hWnd
.hInstance = GetModuleHandle( NULL )
' .lpstrFilter = strptr( !"All Files, (*.*)\0*.*\0Bas Files, (*.BAS)\0*.bas\0\0" )
.lpstrFilter = Strptr( !"Number Files, (*.num)\0*.num\0\0" )
.lpstrCustomFilter = NULL
.nMaxCustFilter = 0
.nFilterIndex = 1
.lpstrFile = @filename
.nMaxFile = sizeof( filename )
.lpstrFileTitle = NULL
.nMaxFileTitle = 0
.lpstrInitialDir = NULL
' .lpstrTitle = @"File Open Test"
.lpstrTitle = @"Save File"
.Flags = OFN_EXPLORER 'or OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST
.nFileOffset = 0
.nFileExtension = 0
.lpstrDefExt = NULL
.lCustData = 0
.lpfnHook = NULL
.lpTemplateName = NULL
End With
If( GetOpenFileName( @ofn ) = FALSE ) Then
file = ""
Return
Else
Dim ext As String
ext = Right(filename,4)
If ext <> ".num" Then
filename = filename + ".num"
End If
file = filename
End If
End Sub
'===============================================
[/code]
It works very well for 32 bit FreeBasic.
However, when using this on FB64, there are several "suspicious warnings" and it does not work.
Does the pointer (& which ones) need to be Qword instead of Dword?
How does the getfilename function need to be changed to operate with 64 bit FB?
Related Question: if "integer" on a 32 bit platform is 32 bits, and on the 64bit platform is 64 bits, does the Dword also match the platform?