1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| FUNCTION CreatePlayerProcess(LOCAL sVideo is string)
hWnd is system int = 0
sExeName is string = ExePath() + "ffplay.exe"
sCmdLine is string = " -autoexit " + sVideo
lpClassName is string ASCIIZ on MAX_PATH = Complete("SDL_app", MAX_PATH, 0)
lpNull is string ASCIIZ on 2 = Complete("", 2, 0)
sVideo = Trim(sVideo, Quote)
nTickMax is unsigned int = GetTickCount() + 2000
pid is unsigned int = ExeRun(sExeName + sCmdLine, exeActive, exePID)
IF pid THEN
WHILE hWnd = 0
Sleep(5)
// Detect console
hConsole is system int = FindWindow("ConsoleWindowClass", sExeName)
IF hConsole THEN
MoveWindow(hConsole, 0, -512, 979, 512, 0)
// Detect FFplay
hWnd = DetectFFplay(sVideo)
END
IF GetTickCount() > nTickMax THEN BREAK // Avoid infinite loop
END
END
gP.hConsole = 0
IF gP.hStdOutput THEN
bRet is boolean = API(KERNEL32, "FreeConsole")
END
IF hWnd THEN
IF hConsole THEN
gP.hConsole = hConsole
OldStyle is unsigned int = GetWindowLongPtr(gP.hConsole, GWL_EXSTYLE)
SetWindowLongPtr(gP.hConsole, GWL_EXSTYLE, OldStyle | WS_EX_TOOLWINDOW)
SetWindowLongPtr(gP.hConsole, GWL_HWNDPARENT, gP.hMain)
//IF AttachConsole(pif.dwProcessId) THEN
IF AttachConsole(pid) THEN
gP.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE)
bRet = GetConsoleScreenBufferInfo(gP.hStdOutput, &gP.bif) //Get console row and column
ReadDuration()
END
END
END
RESULT hWnd |
Partager