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

📄 activexcontainer.tex

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 TEX
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Name:        activexcontainer.tex%% Purpose:     wxActiveXContainer docs%% Author:      Ryan Norton <wxprojects@comcast.net>%% Modified by:%% Created:     01/30/2005%% RCS-ID:      $Id: activexcontainer.tex,v 1.1 2006/02/10 19:37:24 VZ Exp $%% Copyright:   (c) Ryan Norton%% License:     wxWindows license%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\section{\class{wxActiveXContainer}}\label{wxactivexcontainer}wxActiveXContainer is a host for an activex control on Windows (andas such is a platform-specific class). Note that the HWND that the classcontains is the actual HWND of the activex control so using dynamic eventsand connecting to wxEVT\_SIZE, for example, will recieve the actual sizemessage sent to the control.It is somewhat similar to the ATL class CAxWindow in operation.The size of the activex control's content is generally gauranteed to be thatof the client size of the parent of this wxActiveXContainer.You can also process activex events through wxEVT\_ACTIVEX or thecorresponding message map macro EVT\_ACTIVEX.\wxheading{See also}\helpref{wxActiveXEvent}{wxactivexevent}\wxheading{Derived from}\helpref{wxControl}{wxcontrol}\wxheading{Include files}<wx/msw/ole/activex.h>\wxheading{Example}This is an example of how to use the Adobe Acrobat Reader ActiveX control to read PDF files(requires Acrobat Reader 4 and up). Controls like this are typically found and dumped fromOLEVIEW.exe that is distributed with Microsoft Visual C++. This example also demonstrateshow to create a backend for \helpref{wxMediaCtrl}{wxmediactrl}.\begin{verbatim}//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//// wxPDFMediaBackend//// http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/iac/IACOverview.pdf//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#include "wx/mediactrl.h"       // wxMediaBackendCommonBase#include "wx/msw/ole/activex.h" // wxActiveXContainer#include "wx/msw/ole/automtn.h" // wxAutomationObjectconst IID DIID__DPdf = {0xCA8A9781,0x280D,0x11CF,{0xA2,0x4D,0x44,0x45,0x53,0x54,0x00,0x00}};const IID DIID__DPdfEvents = {0xCA8A9782,0x280D,0x11CF,{0xA2,0x4D,0x44,0x45,0x53,0x54,0x00,0x00}};const CLSID CLSID_Pdf = {0xCA8A9780,0x280D,0x11CF,{0xA2,0x4D,0x44,0x45,0x53,0x54,0x00,0x00}};class WXDLLIMPEXP_MEDIA wxPDFMediaBackend : public wxMediaBackendCommonBase{public:    wxPDFMediaBackend() : m_pAX(NULL) {}    virtual ~wxPDFMediaBackend()    {        if(m_pAX)        {            m_pAX->DissociateHandle();            delete m_pAX;        }    }    virtual bool CreateControl(wxControl* ctrl, wxWindow* parent,                                     wxWindowID id,                                     const wxPoint& pos,                                     const wxSize& size,                                     long style,                                     const wxValidator& validator,                                     const wxString& name)    {        IDispatch* pDispatch;        if( ::CoCreateInstance(CLSID_Pdf, NULL,                                  CLSCTX_INPROC_SERVER,                                  DIID__DPdf, (void**)&pDispatch) != 0 )            return false;        m_PDF.SetDispatchPtr(pDispatch); // wxAutomationObject will release itself        if ( !ctrl->wxControl::Create(parent, id, pos, size,                                (style & ~wxBORDER_MASK) | wxBORDER_NONE,                                validator, name) )            return false;        m_ctrl = wxStaticCast(ctrl, wxMediaCtrl);        m_pAX = new wxActiveXContainer(ctrl,                    DIID__DPdf,                    pDispatch);        wxPDFMediaBackend::ShowPlayerControls(wxMEDIACTRLPLAYERCONTROLS_NONE);        return true;    }    virtual bool Play()    {        return true;    }    virtual bool Pause()    {        return true;    }    virtual bool Stop()    {        return true;    }    virtual bool Load(const wxString& fileName)    {        if(m_PDF.CallMethod(wxT("LoadFile"), fileName).GetBool())        {            m_PDF.CallMethod(wxT("setCurrentPage"), wxVariant((long)0));            NotifyMovieLoaded(); // initial refresh            wxSizeEvent event;            m_pAX->OnSize(event);            return true;        }        return false;    }    virtual bool Load(const wxURI& location)    {        return m_PDF.CallMethod(wxT("LoadFile"), location.BuildUnescapedURI()).GetBool();    }    virtual bool Load(const wxURI& WXUNUSED(location),                      const wxURI& WXUNUSED(proxy))    {        return false;    }    virtual wxMediaState GetState()    {        return wxMEDIASTATE_STOPPED;    }    virtual bool SetPosition(wxLongLong where)    {        m_PDF.CallMethod(wxT("setCurrentPage"), wxVariant((long)where.GetValue()));        return true;    }    virtual wxLongLong GetPosition()    {        return 0;    }    virtual wxLongLong GetDuration()    {        return 0;    }    virtual void Move(int WXUNUSED(x), int WXUNUSED(y),                      int WXUNUSED(w), int WXUNUSED(h))    {    }    wxSize GetVideoSize() const    {        return wxDefaultSize;    }    virtual double GetPlaybackRate()    {        return 0;    }    virtual bool SetPlaybackRate(double)    {        return false;    }    virtual double GetVolume()    {        return 0;    }    virtual bool SetVolume(double)    {        return false;    }    virtual bool ShowPlayerControls(wxMediaCtrlPlayerControls flags)    {        if(flags)        {            m_PDF.CallMethod(wxT("setShowToolbar"), true);            m_PDF.CallMethod(wxT("setShowScrollbars"), true);        }        else        {            m_PDF.CallMethod(wxT("setShowToolbar"), false);            m_PDF.CallMethod(wxT("setShowScrollbars"), false);        }        return true;    }    wxActiveXContainer* m_pAX;    wxAutomationObject m_PDF;    DECLARE_DYNAMIC_CLASS(wxPDFMediaBackend)};IMPLEMENT_DYNAMIC_CLASS(wxPDFMediaBackend, wxMediaBackend);\end{verbatim}Put this in one of your existant source files and then create a wxMediaCtrl with\begin{verbatim}//[this] is the parent window, "myfile.pdf" is the PDF file to openwxMediaCtrl* mymediactrl = new wxMediaCtrl(this, wxT("myfile.pdf"), wxID_ANY,                                           wxDefaultPosition, wxSize(300,300),                                           0, wxT("wxPDFMediaBackend"));\end{verbatim}\latexignore{\rtfignore{\wxheading{Members}}}\membersection{wxActiveXContainer::wxActiveXContainer}\label{wxactivexcontainerwxactivexcontainer}\func{}{wxActiveXContainer}{        \param{wxWindow* }{parent},        \param{REFIID }{iid},        \param{IUnknown* }{pUnk},                   }Creates this activex container.\docparam{parent}{parent of this control.  Must not be NULL.}\docparam{iid}{COM IID of pUnk to query. Must be a valid interface to an activex control.}\docparam{pUnk}{Interface of activex control}

⌨️ 快捷键说明

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