const
{Windows Media Player API}
---
WMP_MEDIA_STOP = $D0000;
WMP_MEDIA_PLAY_PAUSE = $E0000;
procedure TForm1.Button4Click(Sender: TObject);
var
wnd : HWND;
WndParent: HWND;
WndChild: HWND;
ClsNameChild:
String;
TitleChild:
String;
begin
wndChild :=FindWindow('
IEFrame','
WMP - Microsoft Internet Explorer');
WndParent := Windows.GetParent(WndChild);
SetLength(ClsNameChild, 1024);
SetLength(ClsNameChild, GetClassName(WndChild, PChar(ClsNameChild), Length(ClsNameChild)));
SetLength(TitleChild, 1024);
SetLength(TitleChild, GetWindowText(WndChild, PChar(TitleChild), Length(TitleChild)));
WndChild := FindWindowEx(WndParent, 0, PChar(ClsNameChild), PChar(TitleChild));
// bis hier ist OK
wnd:= FindWindow(PChar(ClsNameChild),PChar(TitleChild));
if Wnd <> 0
then
Sendmessage(Wnd, WM_APPCOMMAND, 0, WMP_MEDIA_PLAY_PAUSE)
//ShowMessage('gefunden')
else
ShowMessage('
nicht gefunden');
end;