Doens't crash for me in debug mode. I think your problem is somewere else.
SYSTEMPOINTER TRUE
AUTOPAUSE FALSE
LOCAL a$ = Get_Open_File_Name$()
PRINT a$,0,0
SHOWSCREEN
MOUSEWAIT
END
// --------------------------------- //
// Project: Qedo
// Start: Saturday, June 26, 2021
// IDE Version: 16.793
FUNCTION foo:
ENDFUNCTION
INLINE
}
#define HINSTANCE W32HINSTANCE
#define HINSTANCE__ W32HINSTANCE__
#define HMODULE W32HMODULE
#undef LPSTR
#undef DECLARE_HANDLE
#undef LPCTSTR
#undef DWORD
#undef LPWSTR
#undef LPCWSTR
#define HWND W32HWND
#define HWND__ W32HWND__
#define HANDLE W32HANDLE
#undef MAX_PATH
#undef TCHAR
#define WIN32_LEAN_AND_MEAN
#define WinMain WinMain2
#include <windows.h>
#include <commdlg.h>
namespace __GLBASIC__ {
ENDINLINE
FUNCTION Get_Open_File_Name$:
INLINE
char filename[ 1024] = "";
// char filetitle[ 1024 ] = "";
tagOFNA ofn;
char extra_memory_just_to_be_safe[1024];
for(int i=0; i<sizeof(tagOFNA); ++i) // ZeroMemory
{
((char*)&ofn)[i] = 0;
}
ofn.lStructSize = sizeof( ofn );
ofn.hwndOwner = HWND(GLBASIC_HWND()); // If you have a window to center over, put its HANDLE here
ofn.lpstrFilter = "Jpg & Png File\0*.Jpg;*.png\0All Files(.)\0*.*\0";
ofn.lpstrFile = filename;
ofn.nMaxFile = 1000;
char title[1024] = "Select a photo";
ofn.lpstrTitle = title;
ofn.Flags = OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST;
ofn.lpstrInitialDir = "."; // Initial directory.
ofn.lpstrFileTitle = NULL;
int ret=GetOpenFileNameA(&ofn);
return DGStr(filename);
ENDINLINE
ENDFUNCTION
I fear, you're having a buffer overrun somewere else. These are hard to debug and find. Most likely in an INLINE block. Try to make a small as possible program, that crashes and zip it.