[ATL/ActiveX] Full Screen Display ActiveX Control

Source: Internet
Author: User
Currently, many video sharing websites, such as Tudou, use the flash control as the player interface. However, it is very simple to use flash to implement full screen. You only need to set the fullscreen attribute to true, other players, such as mediaplayer, have properties similar to full screen effects. But how can this effect be achieved in custom ActiveX controls? The basic implementation is actually relatively simple. There are also many examples on the Internet, but most of them have bugs. The following is an implementation of my modifications. The results are quite good and the principle is relatively simple.

If (M_bfullscreen)
{
Lockwindowupdate (true );

: Setparent (m_hwnd, m_oldwndparent );
Setwindowplacement (&M_oldwndplacement );

:: setforegroundwindow (m_oldwndparent);
:: setfocus (m_hwnd);

lockwindowupdate (false);
}< br> else
{< br> getwindowplacement ( & m_oldwndplacement );
int nscreenwidth = getsystemmetrics (sm_cxscreen );
int nscreenheight = getsystemmetrics (sm_cyscreen);

M_oldwndparent=: Getparent (m_hwnd );
: Setparent (m_hwnd, getmediatopwindow ());

Windowplacement WP1;
Zeromemory ( & WP1, Sizeof (Windowplacement ));
Wp1.length =   Sizeof (Windowplacement );
Wp1.showcmd = Sw_shownormal;
Wp1.rcnormalposition. Left =   0 ;
Wp1.rcnormalposition. Top =   0 ;
Wp1.rcnormalposition. Right = Nscreenwidth;
Wp1.rcnormalposition. Bottom = Nscreenheight;
Setwindowplacement ( & WP1 );

: Setforegroundwindow (getmediatopwindow ());
: Setforegroundwindow (m_hwnd );
}

M_bfullscreen= !M_bfullscreen;

AboveCodeCorrected an obvious problem in the code that can be found on the Internet.Focus SwitchingThe question is purely the result of my multiple experiments. Don't ask me why I wrote this.

Of course, this code is also problematic, and it is quite strange that everything works normally in "ActiveX control test container", but once the page embedded with this control is switched back to full screen, changing the size of the IE window won't succeed if you try to screen it again. Instead, the result is displayed only in the upper left corner, which is strange:

no clue. If anyone knows this, please kindly advise ^ _ ^

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.