using System.IO;
using System.Threading;
private static int openFolder(string path, uint screen, int xn, int yn) {
if (!Directory.Exists(path)) return 1;
uint appId = BFS.Application.Start("C:\\Windows\\explorer.exe", path);
int width = 795, height = 495;
Rectangle bounds = BFS.Monitor.GetMonitorBoundsByID(screen);
xn = 3 - xn; yn = 3 - yn;
int x = bounds.Width - xn * width;
int y = bounds.Height - yn * height;
if (x < 0) x = 0;
if (y < 0) y = 0;
while (BFS.Application.IsAppRunningByAppID(appId))
Thread.Sleep(250);
IntPtr windowHandle = IntPtr.Zero;
var allWindows = BFS.Window.GetAllWindowHandles();
foreach (var wh in allWindows) {
if (appId == BFS.Application.GetAppIDByWindow(wh)) {
BFS.Dialog.ShowMessageError("aha1");
windowHandle = wh;
break;
}
else if ("TITLE_OF_THE_OPENEND_FOLDER" == BFS.Window.GetText(wh)) {
BFS.Dialog.ShowMessageError("aha2 ai: " + BFS.Application.GetAppIDByWindow(wh));
windowHandle = wh;
break;
}
}
BFS.Dialog.ShowMessageError("ai: " + appId + ", wh: " + windowHandle + " " + allWindows.Length);
setSizeLocMon(windowHandle, x, y, width, height, screen); //just BFS.Window.SetSizeAndLocation and MoveToMonitor
return 0;
}