栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

让MediaPlayer全屏

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

让MediaPlayer全屏

// MediaPlayer.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include 

int _tmain(int argc, _TCHAR* argv[])
{
	//print_window();
	int ret;
	
	//name:"Windows Media Player"
	//1、找到WMP Skin Host类名窗口
	HWND hWnd = FindWindow("WMP Skin Host",NULL);
	HWND child = NULL;
	char szClassName[256] ={0};
	if (hWnd != NULL)
	{
		printf("find 1 = 0x%xn",hWnd);
		BOOL find = FALSE;
		//2、找到带有子窗口名WMP Plugin UI Host的窗口句柄为child
		do 
		{
			child = FindWindowEx(hWnd, child, NULL, NULL);
			
			GetClassName(child,szClassName,256);
			if (child)
			{
				printf("szClassName = %sn",szClassName);
				if ( strcmp(szClassName,"WMP Plugin UI Host") == 0)
				{
					printf("find itn");
					break;
				}
			}
			else
			{
				HWND hNextWnd = GetNextWindow(hWnd,GW_HWNDNEXT);
				if (hWnd != NULL)
				{
					printf("find next wind =0x%xn",hNextWnd);
				}
				else
				{
					printf("not find next wind n");
				}
				hWnd = hNextWnd;
			}
		} while (1);
		//system("pause");
		ret = SendMessage(hWnd,WM_SYSCOMMAND,SC_MAXIMIZE,0);
		ret = SendMessage(child,WM_SYSCOMMAND,SC_MAXIMIZE,0);
		//3、child == WMP Plugin UI Host
		HWND hVideoWnd = NULL;
		do 
		{
			hVideoWnd = FindWindowEx(child, hVideoWnd, NULL, NULL);
			if (hVideoWnd)
			{
				GetClassName(hVideoWnd,szClassName,256);
				printf("szClassName = %sn",szClassName);
				//if (strcmp(szClassName,"EVRVideoHandler") == 0)
				{
					SendMessage(hVideoWnd,WM_SYSCOMMAND,SC_MAXIMIZE,0);
					SendMessage(hVideoWnd, WM_SYSKEYDOWN, VK_RETURN,1<<29);
					//双击全屏
					SendMessage(hVideoWnd, WM_LBUTTONDBLCLK, 0, 0);
					//SendMessage(hVideoWnd,)
				}
				
				child = hVideoWnd;
				printf("child 0x%xn",child);
				hVideoWnd = NULL;
			}
			else
			{
				printf("not find windowsExn");
				break;
			}
		} while (1);

		//system("pause");
		
		//EnumChildWindows(hWnd, EnumChildProc, NULL);
		//WMP Plugin UI Host
		//EVRVideoHandler
	}
	else
	{
		printf("not find Windows Media Player!n");
	}

	//ret = SendMessage(hWnd, WM_SYSKEYDOWN, VK_RETURN,1<<29);
	//system("pause");
	return 0;
}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/528973.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号