⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csdn_文档中心_利用atl制作程序多媒体封面组件.htm

📁 csdn10年中间经典帖子
💻 HTM
📖 第 1 页 / 共 2 页
字号:
			// -->
			</SCRIPT>
      </B>&nbsp;&nbsp;</TD></TR>
  <TR bgColor=#999999>
    <TD colSpan=3 height=1></TD></TR></TBODY></TABLE>
<TABLE border=0 width=770>
  <TBODY>
  <TR>
    <TD align=middle bgColor=#fafafa class=td1 vAlign=top width=150><BR>
      <SCRIPT src="CSDN_文档中心_利用ATL制作程序多媒体封面组件.files/microsoft.js"></SCRIPT>
    </TD>
    <TD align=middle width=620>
      <TABLE bgColor=#eeeeee border=0 cellPadding=0 cellSpacing=0 width=600>
        <TBODY>
        <TR bgColor=#ffffff>
          <TD align=middle height=10 width=50></TD>
          <TD align=right><A href="http://www.csdn.net/">CSDN</A> - <A 
            href="http://www.csdn.net/develop/">文档中心</A> - <FONT 
            color=#003399>Visual C++</FONT>&nbsp;&nbsp;&nbsp;&nbsp; </TD></TR>
        <TR>
          <TD align=middle height=5></TD>
          <TD align=middle width=500></TD></TR>
        <TR>
          <TD align=middle bgColor=#003399 height=10><FONT 
            color=#ffffff>标题</FONT></TD>
          <TD><B>&nbsp;&nbsp;&nbsp;&nbsp;利用ATL制作程序多媒体封面组件</B>&nbsp;&nbsp;&nbsp;&nbsp;wurong(原作) 
          </TD></TR>
        <TR>
          <TD align=middle height=5></TD>
          <TD align=middle width=500></TD></TR>
        <TR>
          <TD align=middle bgColor=#003399><FONT color=#ffffff>关键字</FONT></TD>
          <TD width=500>&nbsp;&nbsp;&nbsp;&nbsp;利用ATL制作程序多媒体封面组件</TD></TR>
        <TR>
          <TD align=middle height=5></TD>
          <TD align=middle width=500></TD></TR></TBODY></TABLE><!--文章说明信息结束//-->
      <TABLE border=0 width=600>
        <TBODY>
        <TR>
          <TD 
            align=left><BR>COM的优越就不多说,使用ATL开发COM方便而快捷,并且具有Size小,Dependency少的特点。VC++的import 
            编译支持更是对COM开发的巨大支持。闲话休说,这就开始吧。<BR>&nbsp; 一.Flash组件<BR>&nbsp; &nbsp; 
            &nbsp; &nbsp; 1.ATL COM AppWizard创建新项目"ATLFlash",选择DLL类型。<BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; 2.加入ATL Object "Flash"<BR>&nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; &nbsp; Insert -&gt;&nbsp; New ATL Object<BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 选择Object中的Simple 
            Object,<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Short 
            Name:“FLash”<BR>&nbsp; &nbsp; &nbsp; &nbsp; 3.接口添加Method 
            “Play”<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 参数为:[in]BSTR 
            bstrFile,[in]long hInstance,[in]long hWnd<BR>&nbsp; &nbsp; &nbsp; 
            &nbsp; 4.在CFlash类中加入:<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            private:<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; &nbsp; HWND m_hWnd;//视频窗口句柄<BR>&nbsp; &nbsp; &nbsp; 
            &nbsp; 5. 实现Play方法。<BR>STDMETHODIMP CFlash::Play(BSTR bstrFile, long 
            hInstance, long 
            hWnd)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;try{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_hMCIWnd=(HWND)hWnd;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_bstr_t 
            file(bstrFile);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_hMCIWnd=::MCIWndCreate((HWND)hWnd,(HINSTANCE)hInstance,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WS_POPUP&brvbar;WS_VISIBLE&brvbar;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MCIWNDF_NOPLAYBAR&brvbar;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MCIWNDF_NOMENU,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(char 
            *)file);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RECT 
            rect;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int 
            sx,sy;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::GetWindowRect(m_hMCIWnd,&amp;rect);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sx=(::GetSystemMetrics(SM_CXSCREEN)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-rect.right+rect.left)/2;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sy=(::GetSystemMetrics(SM_CYSCREEN)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-rect.bottom+rect.top)/2;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//窗口居中<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::SetWindowPos(m_hMCIWnd,HWND_TOPMOST,sx,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sy,0,0,SWP_SHOWWINDOW&brvbar;SWP_NOSIZE);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g_nLength=MCIWndGetLength(m_hMCIWnd);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MCIWndPlay(m_hMCIWnd);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SetTimer(m_hMCIWnd,1,50,TimerProc);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}catch(...)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AtlTrace("error:%ul",::GetLastError()); 
            <BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;return 
            S_OK;<BR>}<BR>&nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            6.Flash.cpp中实现TimerProc,用于关闭视频窗口。<BR>long g_nLength;<BR>VOID 
            CALLBACK 
            TimerProc(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HWND 
            hwnd,&nbsp; &nbsp; // handle of window for timer 
            messages<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UINT 
            uMsg,&nbsp; &nbsp; // WM_TIMER 
            message<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UINT 
            idEvent,&nbsp; // timer 
            identifier<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DWORD 
            dwTime&nbsp; // current system 
            time<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;long 
            nLength;<BR>&nbsp;&nbsp;&nbsp;&nbsp;BOOL 
            bEscape=::GetKeyState(VK_ESCAPE)&amp;0x0100;<BR>&nbsp;&nbsp;&nbsp;&nbsp;nLength=MCIWndGetPosition(hwnd);<BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            //视频放完,或点击ESC键,关闭视频窗口<BR>&nbsp;&nbsp;&nbsp;&nbsp;if((nLength&gt;=g_nLength)&brvbar;&brvbar;(bEscape)){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;KillTimer(hwnd,idEvent);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MCIWndEnd(hwnd);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MCIWndClose(hwnd);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MCIWndDestroy(hwnd);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>};<BR>&nbsp; 
            &nbsp; &nbsp; &nbsp; 7.stdafx.h中加入<BR>&nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; #include &lt;vwf.h&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; 项目设置中加入“vwf32.lib”库,<BR>&nbsp; &nbsp; &nbsp; &nbsp; 
            &nbsp; &nbsp; 打开项目设置中C++,C++language中的Enable Error 
            Handling<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            编译,一切OK。<BR>二,组件的使用。<BR>&nbsp; &nbsp; &nbsp; 
            1.创建一个MDI或SDI项目"FlashClient"<BR>&nbsp; &nbsp; &nbsp; 
            2.stdafx.h中加入<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #import 
            “ATLFlash.dll” no_namespace<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            FlashCient.cpp中加入<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; struct 
            _InitCom{<BR>&nbsp;&nbsp;&nbsp;&nbsp;_InitCom(){::CoInitialize(NULL);}<BR>&nbsp;&nbsp;&nbsp;&nbsp;~_InitCom(){::CoUninitialize(); 
            }<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }__InitCom;<BR>&nbsp; &nbsp; 
            &nbsp; 3.CFlashClientView加入<BR>&nbsp; &nbsp; &nbsp; &nbsp; 
            private:<BR>&nbsp;&nbsp;&nbsp;&nbsp;IFlashPtr 
            pFlashServer;<BR>&nbsp; &nbsp; &nbsp; 
            4.CFlashClent::OnInitialUpdate()加入<BR>&nbsp;&nbsp;&nbsp;&nbsp;_bstr_t 
            file("Sample.avi");<BR>&nbsp;&nbsp;&nbsp;&nbsp;pFlashServer-&gt;Play(&nbsp;&nbsp;&nbsp;&nbsp;file,(long)::AfxGetInstanceHandle(),(long)this-&gt;GetSafeHwnd());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp; 
            &nbsp; &nbsp; 
5.编译,一切OK。<BR></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR>
<TABLE align=center bgColor=#006699 border=0 cellPadding=0 cellSpacing=0 
width=770>
  <TBODY>
  <TR bgColor=#006699>
    <TD align=middle bgColor=#006699 id=white><FONT 
    color=#ffffff>对该文的评论</FONT></TD>
    <TD align=middle>
      <SCRIPT src="CSDN_文档中心_利用ATL制作程序多媒体封面组件.files/readnum.htm"></SCRIPT>
    </TD></TR></TBODY></TABLE>
<TABLE align=center bgColor=#666666 border=0 cellPadding=2 cellSpacing=1 
width=770>
  <TBODY>
  <TR>
    <TD bgColor=#cccccc colSpan=3><SPAN style="COLOR: #cccccc"><IMG height=16 
      hspace=1 src="CSDN_文档中心_利用ATL制作程序多媒体封面组件.files/ico_pencil.gif" width=16> 
      </SPAN>&nbsp;&nbsp;&nbsp;&nbsp; tianguiyun <I>(2001-4-18 20:26:00)</I> 
  </TD></TR>
  <TR>
    <TD bgColor=#ffffff colSpan=3 width=532><BR>#include &lt;vwf.h&gt; 
      项目设置中加入“vwf32.lib”库, Where do you find the lib ?? Please email me 
      g.y.tian@hud.ac.uk <BR></TD></TR></TBODY></TABLE><BR>
<DIV align=center>
<TABLE align=center bgColor=#cccccc border=0 cellPadding=2 cellSpacing=1 
width=770>
  <TBODY>
  <TR>
    <TH bgColor=#006699 id=white><FONT 
color=#ffffff>我要评论</FONT></TH></TR></TBODY></TABLE></DIV>
<DIV align=center>
<TABLE border=0 width=770>
  <TBODY>
  <TR>
    <TD>你没有登陆,无法发表评论。 请先<A 
      href="http://www.csdn.net/member/login.asp?from=/Develop/read_article.asp?id=1098">登陆</A> 
      <A 
href="http://www.csdn.net/expert/zc.asp">我要注册</A><BR></TD></TR></TBODY></TABLE></DIV><BR>
<HR noShade SIZE=1 width=770>

<TABLE border=0 cellPadding=0 cellSpacing=0 width=500>
  <TBODY>
  <TR align=middle>
    <TD height=10 vAlign=bottom><A 
      href="http://www.csdn.net/intro/intro.asp?id=2">网站简介</A> - <A 
      href="http://www.csdn.net/intro/intro.asp?id=5">广告服务</A> - <A 
      href="http://www.csdn.net/map/map.shtm">网站地图</A> - <A 
      href="http://www.csdn.net/help/help.asp">帮助信息</A> - <A 
      href="http://www.csdn.net/intro/intro.asp?id=2">联系方式</A> - <A 
      href="http://www.csdn.net/english">English</A> </TD>
    <TD align=middle rowSpan=3><A 
      href="http://www.hd315.gov.cn/beian/view.asp?bianhao=010202001032100010"><IMG 
      border=0 height=48 src="CSDN_文档中心_利用ATL制作程序多媒体封面组件.files/biaoshi.gif" 
      width=40></A></TD></TR>
  <TR align=middle>
    <TD vAlign=top>百联美达美公司 版权所有 京ICP证020026号</TD></TR>
  <TR align=middle>
    <TD vAlign=top><FONT face=Verdana>Copyright &copy; CSDN.net, Inc. All rights 
      reserved</FONT></TD></TR>
  <TR>
    <TD height=15></TD>
    <TD></TD></TR></TBODY></TABLE></DIV>
<DIV></DIV><!--内容结束//--><!--结束//--></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -