it cause the problem?. How can i fill the child window with video?
Thanks in advanced.
Code: Select all
#Include Once "windows.bi"
#Include Once "win/mmsystem.bi"
' Change this to video file path:
#Define VIDEO_FILE1 "c:\videos\video6.mpg"
#Define VIDEO_FILE2 "c:\videos\video2.avi"
#Define VIDEO_FILE3 "c:\videos\video1.avi"
#Define VIDEO_FILE4 "c:\videos\video4.mp4"
Dim Shared As HINSTANCE hInst
hInst = GetModuleHandle(NULL)
Dim Shared As HWND video, overlay
Function WndProc(hWnd As HWND, msg As UINT, wParam As WPARAM, lParam As LPARAM) As LRESULT
Select Case msg
Case WM_CREATE
video = CreateWindowEx(NULL, "Static", "", WS_CHILD OR WS_VISIBLE OR SS_USERITEM, _
100, 100, 600, 400, hWnd, 0, hInst, 0)
mciSendString("open """ & VIDEO_FILE3 & """ type MPEGVideo Alias myvid", 0, 0, 0)
mciSendString("window myvid handle " & video, 0, 0, 0)
Dim rcmovie As rect
getCLIENTrect(video,@rcmovie)
mciSendString("put myvid destination at 0 0 700 500 " , 0, 0, 0)
mciSendString("play myvid", 0, 0, 0)
'mciSendString("play myvid fullscreen", lpszReturnString,lstrlen(lpszReturnString), NULL);
'mciSendString("play myvid fullscreen", 0,0,0)
Dim As ZString*256 ret
mciSendString("status myvid frame rate", ret, 256, 0)
Case WM_DESTROY
'DeleteObject(hf)
PostQuitMessage(NULL)
End Select
Return DefWindowProc(hWnd, msg, wParam, lParam)
End Function
Dim As MSG uMsg
Dim As WNDCLASS wcls
Dim As HWND hWnd
With wcls
.style = CS_HREDRAW Or CS_VREDRAW
.lpfnWndProc = Cast(WNDPROC, @WndProc)
.hInstance = hInst
.hIcon = LoadIcon(NULL, IDI_APPLICATION)
.hCursor = LoadCursor(NULL, IDC_ARROW)
.hbrBackground = GetStockObject(WHITE_BRUSH)
.lpszMenuName = NULL
.lpszClassName = StrPtr("WindowClass")
End With
If RegisterClass(@wcls) = FALSE Then
MessageBox(NULL, "RegisterClass(@wcls) FAIL!", "Error!", MB_OK Or MB_ICONERROR)
End
EndIf
hWnd = CreateWindowEx(0,WCls.lpszClassName, "Window", WS_POPUP Or WS_VISIBLE Or _
WS_CLIPCHILDREN Or WS_CLIPSIBLINGS, 10, 10, 1000, 800, NULL, NULL, hInst, NULL)
ShowWindow(hWnd, SW_NORMAL)
UpdateWindow(hWnd)
While GetMessage(@uMsg, NULL, NULL, NULL) <> FALSE
TranslateMessage(@uMsg)
DispatchMessage(@uMsg)
Wend