00001
00002
00003 #include "stdafx.h"
00004 #include "axAnxOggPlayer.h"
00005 #include "axAnxOggPlayerCtrl.h"
00006 #include "axAnxOggPlayerPropPage.h"
00007 #include ".\axanxoggplayerctrl.h"
00008
00009
00010 #ifdef _DEBUG
00011 #define new DEBUG_NEW
00012 #endif
00013
00014
00015 IMPLEMENT_DYNCREATE(CaxAnxOggPlayerCtrl, COleControl)
00016
00017
00018
00019
00020
00021 BEGIN_MESSAGE_MAP(CaxAnxOggPlayerCtrl, COleControl)
00022 ON_MESSAGE(OCM_COMMAND, OnOcmCommand)
00023 ON_OLEVERB(AFX_IDS_VERB_PROPERTIES, OnProperties)
00024 ON_WM_CREATE()
00025 END_MESSAGE_MAP()
00026
00027
00028
00029
00030
00031 BEGIN_DISPATCH_MAP(CaxAnxOggPlayerCtrl, COleControl)
00032 DISP_FUNCTION_ID(CaxAnxOggPlayerCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
00033 END_DISPATCH_MAP()
00034
00035
00036
00037
00038
00039 BEGIN_EVENT_MAP(CaxAnxOggPlayerCtrl, COleControl)
00040 END_EVENT_MAP()
00041
00042
00043
00044
00045
00046
00047 BEGIN_PROPPAGEIDS(CaxAnxOggPlayerCtrl, 1)
00048 PROPPAGEID(CaxAnxOggPlayerPropPage::guid)
00049 END_PROPPAGEIDS(CaxAnxOggPlayerCtrl)
00050
00051
00052
00053
00054
00055 IMPLEMENT_OLECREATE_EX(CaxAnxOggPlayerCtrl, "AXANXOGGPLAYER.axAnxOggPlayerCtrl.1",
00056 0x9b80daa5, 0xbcfa, 0x44f8, 0xb2, 0xaa, 0xb2, 0xec, 0xf8, 0x6, 0x2, 0xa1)
00057
00058
00059
00060
00061
00062 IMPLEMENT_OLETYPELIB(CaxAnxOggPlayerCtrl, _tlid, _wVerMajor, _wVerMinor)
00063
00064
00065
00066
00067
00068 const IID BASED_CODE IID_DaxAnxOggPlayer =
00069 { 0xB878657F, 0xFA23, 0x4915, { 0x8E, 0x80, 0x66, 0x64, 0xF1, 0x73, 0x8B, 0xEF } };
00070 const IID BASED_CODE IID_DaxAnxOggPlayerEvents =
00071 { 0x380DE0F9, 0x5B8, 0x4D01, { 0x92, 0x21, 0xC6, 0x48, 0xBC, 0x43, 0x24, 0x23 } };
00072
00073
00074
00075
00076
00077 static const DWORD BASED_CODE _dwaxAnxOggPlayerOleMisc =
00078 OLEMISC_ACTIVATEWHENVISIBLE |
00079 OLEMISC_SETCLIENTSITEFIRST |
00080 OLEMISC_INSIDEOUT |
00081 OLEMISC_CANTLINKINSIDE |
00082 OLEMISC_RECOMPOSEONRESIZE;
00083
00084 IMPLEMENT_OLECTLTYPE(CaxAnxOggPlayerCtrl, IDS_AXANXOGGPLAYER, _dwaxAnxOggPlayerOleMisc)
00085
00086
00087
00088
00089
00090
00091 BOOL CaxAnxOggPlayerCtrl::CaxAnxOggPlayerCtrlFactory::UpdateRegistry(BOOL bRegister)
00092 {
00093
00094
00095
00096
00097
00098
00099 if (bRegister)
00100 return AfxOleRegisterControlClass(
00101 AfxGetInstanceHandle(),
00102 m_clsid,
00103 m_lpszProgID,
00104 IDS_AXANXOGGPLAYER,
00105 IDB_AXANXOGGPLAYER,
00106 afxRegApartmentThreading,
00107 _dwaxAnxOggPlayerOleMisc,
00108 _tlid,
00109 _wVerMajor,
00110 _wVerMinor);
00111 else
00112 return AfxOleUnregisterClass(m_clsid, m_lpszProgID);
00113 }
00114
00115
00116
00117
00118
00119 CaxAnxOggPlayerCtrl::CaxAnxOggPlayerCtrl()
00120 {
00121 InitializeIIDs(&IID_DaxAnxOggPlayer, &IID_DaxAnxOggPlayerEvents);
00122
00123 debugLog.open("G:\\logs\\ax_cntrol.log", ios_base::out);
00124 debugLog<<"Control activated..."<<endl;
00125 }
00126
00127
00128
00129
00130
00131 CaxAnxOggPlayerCtrl::~CaxAnxOggPlayerCtrl()
00132 {
00133
00134 }
00135
00136
00137
00138
00139
00140 void CaxAnxOggPlayerCtrl::OnDraw(
00141 CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
00142 {
00143 if (!pdc)
00144 return;
00145
00146 DoSuperclassPaint(pdc, rcBounds);
00147 }
00148
00149
00150
00151
00152
00153 void CaxAnxOggPlayerCtrl::DoPropExchange(CPropExchange* pPX)
00154 {
00155 ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
00156 COleControl::DoPropExchange(pPX);
00157
00158
00159 }
00160
00161
00162
00163
00164
00165 void CaxAnxOggPlayerCtrl::OnResetState()
00166 {
00167 COleControl::OnResetState();
00168
00169
00170 }
00171
00172
00173
00174
00175
00176 void CaxAnxOggPlayerCtrl::AboutBox()
00177 {
00178 CDialog dlgAbout(IDD_ABOUTBOX_AXANXOGGPLAYER);
00179 dlgAbout.DoModal();
00180 }
00181
00182
00183
00184
00185
00186 BOOL CaxAnxOggPlayerCtrl::PreCreateWindow(CREATESTRUCT& cs)
00187 {
00188 debugLog<<"Pre create..."<<endl;
00189 cs.lpszClass = _T("STATIC");
00190 return COleControl::PreCreateWindow(cs);
00191 }
00192
00193
00194
00195
00196
00197 BOOL CaxAnxOggPlayerCtrl::IsSubclassedControl()
00198 {
00199 return TRUE;
00200 }
00201
00202
00203
00204
00205
00206 LRESULT CaxAnxOggPlayerCtrl::OnOcmCommand(WPARAM wParam, LPARAM lParam)
00207 {
00208 #ifdef _WIN32
00209 WORD wNotifyCode = HIWORD(wParam);
00210 #else
00211 WORD wNotifyCode = HIWORD(lParam);
00212 #endif
00213
00214
00215
00216 return 0;
00217 }
00218
00219
00220
00221
00222
00223 int CaxAnxOggPlayerCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
00224 {
00225 debugLog<<"On create..."<<endl;
00226 if (COleControl::OnCreate(lpCreateStruct) == -1)
00227 return -1;
00228
00229
00230
00231 mDialog.Create(IDD_DIALOG1, this);
00232 mDialog.ShowWindow(TRUE);
00233
00234
00235 IServiceProvider* locISP = NULL;
00236 IWebBrowser2* locBrowser = NULL;
00237
00238 HRESULT locHR = GetClientSite()->QueryInterface(IID_IServiceProvider, (void **)&locISP);
00239 if (locHR == S_OK) {
00240 locHR = locISP->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, (void **)&locBrowser);
00241 if (locHR == S_OK) {
00242 mDialog.setBrowser(locBrowser);
00243
00244 }
00245 locISP->Release();
00246 }
00247 return 0;
00248 }