Jump to content

mplayer -wid (windows handle)


michael2t
 Share

Recommended Posts

Hello All ...

mplayer has a option -wid that you can pass it a window handle ... But I can not get it to work ...

I want mplayer in a autoit window ...

$trailerplay = "trailer.avi"

$mplayerpid = Run(@WorkingDir&'\MPlayer\mplayer.exe -nomouseinput -slave -quiet -noborder -ontop "'&$trailerplay&'"', @ScriptDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD + $STDIN_CHILD)

thanks all

Michael T.

Edited by michael2t
Link to comment
Share on other sites

  • 3 weeks later...

On Windows XP, with a Sample MFC application, the following basic example command line sequence embeds Mplayer into an HWND. The following code snippet is called within some derived CView class instance (notice the this->m_hWnd reference):

//

// Mplayer executable Path

//

string strProcessPath = "C:\\mplayer.exe";

string strCommandLine = "";

strCommandLine += " -slave -identify -noquiet -vo directx:noaccel ";

char achNumBuffer[256];

memset(achNumBuffer, '\0', sizeof(achNumBuffer));

sprintf(achNumBuffer, "-wid %d", (int)this->m_hWnd);

strCommandLine += " ";

strCommandLine += (string)achNumBuffer;

strCommandLine += " -colorkey 0x000000 -framedrop ";

//

// Playable Video Path

//

strCommandLine += "C:\\testvideo.m4v";

SHELLEXECUTEINFO shExecInfo;

shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);

shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;

shExecInfo.hwnd = NULL;

shExecInfo.lpVerb = "open";

shExecInfo.lpDirectory = NULL;

shExecInfo.nShow = SW_SHOW;

shExecInfo.hInstApp = NULL;

shExecInfo.lpFile = strProcessPath.c_str();

shExecInfo.lpParameters = strCommandLine.c_str();

ShellExecuteEx(&shExecInfo);

::CloseHandle(shExecInfo.hProcess);

Link to comment
Share on other sites

In AutoIt this should be this:

Local $strCommandLine = "";
$strCommandLine &= " -slave -identify -noquiet -vo directx:noaccel ";

$strCommandLine &= " ";
$strCommandLine &= "-wid " & Number($m_hWnd);

$strCommandLine &= " -colorkey 0x000000 -framedrop ";
;------
$strCommandLine &= '"C:\\Your_Path\video.avi"'

I think, your problem was you forgot to convert the hWnd to an Integer.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...