ivantu пишет: при новом вызове функции открывается новая командная строка и весит в фоне
CODE:external(INT, "ShellExecute", "ShellExecuteA", "Shell32.dll");
#define SW_HIDE 0
#define SW_SHOW 5
external(INT, "ShowWindow", "ShowWindow", "User32.dll");
//system_("cd "+pathfolder()+"adb\ & adb.exe & adb shell screencap /sdcard/screen.png & adb pull /sdcard/screen.png"); // открыть калькулятор
testing:;
sleep(1000);
//system_("cd "+pathfolder()+"adb\ & adb shell screencap /sdcard/screen.png & adb pull /sdcard/screen.png"); // открыть калькулятор
system_("cd "+pathfolder()+"adb\ & adb devices");
goto testing;
function system_(string command)
{
while (window (-1, "ConsoleWindowClass", -1)!=0)
{
sendmessage(WM_CLOSE, 0, 0, window (-1, "ConsoleWindowClass", -1));
sleep(100);
}
ShellExecute(0, "open", "cmd.exe", "/s "+command, "", 0);
while (window (-1, "ConsoleWindowClass", -1)!=0)
{
sendmessage(WM_CLOSE, 0, 0, window (-1, "ConsoleWindowClass", -1));
sleep(100);
}
} |