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 ^ _ ^