Aurel,
Something strange happening when ShellExecute is invoked. Will investigate further.
With regard to performance, the strategy is to reduce the number of string operations, in favour of integer operations, so the CPU has less work to do. That function is only one part of your parser.
PS:
ShellExecute is innocent. The problem was in the FileDialog prototype.
Cleanup for FileDialog:
Defext was defined as 'long', is now a string
Also using strptr for all string parameters.
FileDialog for awinh.inc
'FileDialog( $ iDir , $ filter ,$ title , % parent ,% flag )
Function FileDialog(String Dir, filter , Title , long Hwnd, Flags, string defext) As String
Dim ofn As OPENFILENAME
Dim filename[255] As zstring
INT retval
ofn.lStructSize = 76
ofn.hwndOwner = hWnd
ofn.hInstance = GetModuleHandle(0)
ofn.lpstrFilter = strptr filter
ofn.lpstrCustomFilter= NULL
ofn.nMaxCustFilter = 0
ofn.nFilterIndex = 2
ofn.lpstrFile = strptr filename 'zstring buffer
ofn.nMaxFile = 255
ofn.lpstrFileTitle = NULL
ofn.nMaxFileTitle = 0
ofn.lpstrInitialDir = strptr dir
ofn.lpstrTitle = strptr title
IF Flags = 0 then ofn.Flags = OFN_EXPLORER Or OFN_FILEMUSTEXIST Or OFN_HIDEREADONLY
IF Flags = 1 then ofn.Flags = OFN_EXPLORER Or OFN_OVERWRITEPROMPT Or OFN_HIDEREADONLY
ofn.nFileOffset = 0
ofn.nFileExtension = 0
ofn.lpstrDefExt = strptr defext
ofn.lCustData = 0
ofn.lpfnHook = 0
ofn.lpTemplateName = NULL
' Execute the dialog box
IF Flags = 0 then retval = GetOpenFileName(ofn)
IF Flags = 1 then retval = GetSaveFileName(ofn)
Return filename
End Function