Damn I've missed this at the very start but the forum had provided everything needed to embed wmp via ATL. That doesn't solve every question but this should be what you were asking for at first place.
Take a look at this nice code and at the topic which link appears on top to read the author's comment.
Code: Select all
'Usage of ATL lib for embedding WMPlayer.ocx object
'source by MichaelW
'http://www.freebasic.net/forum/viewtopic.php?f=6&t=15962&hilit=createwindow
'==============================================================================
#Include "windows.bi"
'==============================================================================
Function WindowProc( byval hWnd as HWND,_
byval uMsg as uint,_
byval wParam as WPARAM,_
byval lParam as LPARAM ) as LRESULT
static as any ptr hLib
static as HWND hwndCal
dim as sub AtlAxWinInit
select case uMsg
case WM_CREATE
hLib = DylibLoad( "atl.dll" )
if hLib = 0 then
MessageBox( hWnd, "DylibLoad error", 0, 0 )
end if
AtlAxWinInit = DylibSymbol( hLib, "AtlAxWinInit" )
if AtlAxWinInit = 0 then
MessageBox( hWnd, "DylibSymbol error", 0, 0 )
end if
AtlAxWinInit()
hwndCal = CreateWindow( "AtlAxWin", "WMPlayer.ocx", _
WS_CHILD or WS_VISIBLE, 0, 0, _
390, 275, hWnd, NULL, _
GetModuleHandle(NULL), NULL)
if hwndCal = 0 then
MessageBox( hWnd, "CreateWindow error", 0, 0 )
end if
case WM_COMMAND
select case wParam
case IDCANCEL
DestroyWindow( hWnd )
end select
case WM_CLOSE
DestroyWindow( hWnd )
case WM_DESTROY
PostQuitMessage( null )
case else
return DefWindowProc( hWnd, uMsg, wParam, lParam )
end select
return 0
End function
'==============================================================================
Dim as integer wx, wy, nWidth, nHeight
Dim as WNDCLASSEX wcx
Dim as HWND hWnd
Dim as MSG wMsg
Dim as string class_name = "class_name"
With wcx
.cbSize = sizeof( WNDCLASSEX )
.style = CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNWINDOW
.lpfnWndProc = cast( WNDPROC, @WindowProc )
.cbClsExtra = null
.cbWndExtra = null
.hInstance = GetModuleHandle( null )
.hbrBackground = cast( HBRUSH,COLOR_WINDOW + 1 )
.lpszMenuName = null
.lpszClassName = strptr(class_name)
.hIcon = LoadIcon( null, IDI_APPLICATION )
.hCursor = LoadCursor ( null, IDC_ARROW )
.hIconSm = 0
End with
RegisterClassEx( @wcx )
nWidth = 400
nHeight = 300
wx = (GetSystemMetrics( SM_CXSCREEN ) / 2) - nWidth / 2
wy = (GetSystemMetrics( SM_CYSCREEN ) / 2) - nHeight / 2
hWnd = CreateWindowEx( WS_EX_OVERLAPPEDWINDOW, _
strptr(class_name), _
"Test", _
WS_OVERLAPPED or WS_SYSMENU or WS_VISIBLE, _
wx, _
wy, _
nWidth, _
nHeight, _
null, _
null, _
GetModuleHandle( null ), _
null )
ShowWindow( hWnd, SW_SHOWNORMAL )
Do while GetMessage( @wMsg, null, 0, 0 ) <> 0
if IsDialogMessage( hWnd, @wMsg ) = 0 then
TranslateMessage( @wMsg )
DispatchMessage( @wMsg )
end if
Loop
'==============================================================================