Коллега придумал вариант для 4-ки.
Он универсальный и подходит для ax 3.0 - 2012
И мне нравится больше чем вариант с infolog.yield()
Делаем в global пару методов
X++:
// Для предотвращения создания операционкой окна-призрака поверх окна клиента АХ
// что выглядит как повисание системы, даже если в это время идет перерисовка прогресса
// Данную функцию следует вызывать не реже чем #TimeInterval секунд (объявлено в preventWindowsGhostingClient_MRC())
// JEV003298 "Оптимизация работы отчета "Остатки в открытом заказе (расширенный)"", shai 26.02.2019
public static void preventWindowsGhosting_MRC()
{
;
if (hasGUI())
{
preventWindowsGhostingClient_MRC();
}
}
X++:
// JEV003298 "Оптимизация работы отчета "Остатки в открытом заказе (расширенный)"", shai 26.02.2019
client private static void preventWindowsGhostingClient_MRC()
{
Binary message;
DLL winApiDLL;
DLLFunction peekMessage;
Struct cachedData;
SysGlobalCache globalCache;
timeOfDay lastTime;
timeOfDay newTime;
#define.DLL("USER32")
#define.DLLFunctionPeekMessageA("PeekMessageA")
#define.GlobalCacheOwner("Global_preventWindowsGhosting_MRC")
#define.messageBinary_30(30)
#define.PM_NOREMOVE(0)
#define.TimeInterval(2)
;
newTime = timenow();
globalCache = infolog.globalCache();
cachedData = globalCache.get(#GlobalCacheOwner, "cachedData", cachedData);
if (!cachedData)
{
winApiDLL = new DLL(#DLL);
peekMessage = new DLLFunction(winApiDLL, #DLLFunctionPeekMessageA);
peekMessage.arg(ExtTypes::Pointer, ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord);
message = new Binary(#messageBinary_30);
cachedData = new Struct();
cachedData.add("lastTime", -#TimeInterval - 1);
cachedData.add("peekMessage", peekMessage);
cachedData.add("messageBuf", message);
globalCache.set(#GlobalCacheOwner, "cachedData", cachedData);
}
lastTime = cachedData.value("lastTime");
if (abs(newTime - lastTime) > #TimeInterval)
{
peekMessage = cachedData.value("peekMessage");
message = cachedData.value("messageBuf");
peekMessage.call(message, 0, 0, 0, #PM_NOREMOVE);
cachedData.value("lastTime", newTime);
globalCache.set(#GlobalCacheOwner, "cachedData", cachedData);
}
}
Затем в \Classes\SysOperationProgressBase\update
делаем так
X++:
...
}
// JEV003298 "Оптимизация работы отчета "Остатки в открытом заказе (расширенный)"", shai 27.02.2019 -->
preventWindowsGhosting_MRC();
// JEV003298 "Оптимизация работы отчета "Остатки в открытом заказе (расширенный)"", shai 27.02.2019 <--
if (conlen(progress))
{
t1 = WinAPI::getTickCount();
this.sendProgress(progress);
if ((WinAPI::getTickCount() - t1)/*milliseconds*/ div 100 >= updateInterval /*seconds*/)
updateInterval++;
}
this.updateTime();
}
}
}
P.S. При таком способе на Ctrl-break реагирует сразу, т.е. система стала более отзывчивой. Раньше из-за WindowsGhosting могло игнорировать.