Edit 1:
DllCalls to comdlg32.dll\GetSaveFileName and comdlg32.dll\GetOpenFileName seem to be where the issue is happening using SKAN's function.
Edit 2:
Still trying.
I've created a dll in C# with exported functions. I used OpenFileDialog from System.Windows.Forms instead of Microsoft.Win32. The dll works as expected with AHK_L, but I'm still getting the same hanging issue when trying to open a file using AHK_H.
[DllExport]
public static string FileSelect(IntPtr owner, string filter = "", string defaultExt = "", string initialDir = "", string title = "")
{
NativeWindow nativeWindow = new NativeWindow();
nativeWindow.AssignHandle(owner);
var fileDialog = new OpenFileDialog()
{
DefaultExt = defaultExt == "" ? "*.*" : defaultExt,
Filter = filter == "" ? "All files(*.*)|*.*" : filter,
Multiselect = false,
CheckFileExists = true,
CheckPathExists = true,
Title = title == "" ? "Open File" : title,
InitialDirectory = initialDir
};
var result = fileDialog.ShowDialog(nativeWindow);
nativeWindow.ReleaseHandle();
if (result == DialogResult.OK)
return fileDialog.FileName;
return "";
}
Edit 3:
This is still happening. It stopped for about three days and everything worked fine. Now it is back to hanging every time I try to open a file. I can hear an error noise but there is no popup or messagebox anywhere.
From the manual:>> Known limitation: A timer that launches during the display of a FileSelectFile dialog will postpone the effect of the user's clicks inside the dialog until after the timer finishes. To work around this, avoid using timers whose subroutines take a long time to finish, or disable all timers during the dialog: