本文整理汇总了C++中CComQIPtr类的典型用法代码示例。如果您正苦于以下问题:C++ CComQIPtr类的具体用法?C++ CComQIPtr怎么用?C++ CComQIPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CComQIPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AutoBrowser
void CSXSView::OnTimer(UINT_PTR nIDEvent)
{
CAutoBrowser AutoBrowser((IWebBrowser2 *)GetApplication(),GetIEServerWnd());
if (nIDEvent == TIME_ID_INPUT_LOGIN)
{
KillTimer(nIDEvent);
//输入用户名
{
CElementInformation ElemInfo;
ElemInfo.SetTagName(L"input");
ElemInfo.AddElementAttribute(L"id",L"edit-name",TRUE);
CElemRectList ElemList;
AutoBrowser.GetAllMatchElemRect(&ElemList,&ElemInfo);
if (ElemList.GetElemRectCount() == 1)
{
ELEM_RECT ElemRect;
ElemList.GetElemRectByIndex(0,&ElemRect);
CComQIPtr<IHTMLInputElement> pInput;
ElemRect.pElem->QueryInterface(IID_IHTMLInputElement,(void **)&pInput);
pInput->put_value(theApp.m_strUserName.AllocSysString());
}
}
//输入密码
{
CElementInformation ElemInfo;
ElemInfo.SetTagName(L"input");
ElemInfo.AddElementAttribute(L"id",L"edit-pass",TRUE);
CElemRectList ElemList;
AutoBrowser.GetAllMatchElemRect(&ElemList,&ElemInfo);
if (ElemList.GetElemRectCount() == 1)
{
ELEM_RECT ElemRect;
ElemList.GetElemRectByIndex(0,&ElemRect);
CComQIPtr<IHTMLInputElement> pInput;
ElemRect.pElem->QueryInterface(IID_IHTMLInputElement,(void **)&pInput);
pInput->put_value(theApp.m_strPassWord.AllocSysString());
}
}
//选中验证码框
{
CElementInformation ElemInfo;
ElemInfo.SetTagName(L"input");
ElemInfo.AddElementAttribute(L"id",L"edit-captcha-response",TRUE);
AutoBrowser.ClickFirstMatchWebPageElement(&ElemInfo);
}
}
if (nIDEvent == TIME_ID_MOUSE_MOVE)
{
CRect rcClient;
GetClientRect(&rcClient);
AutoBrowser.SetWebPageMousePos(CAutoBrowser::GetRandValue(0,rcClient.Width()),CAutoBrowser::GetRandValue(0,rcClient.Height()));
}
if ( nIDEvent == TIME_ID_QUERY_USER_INFO )
{
KillTimer(nIDEvent);
CString strUserRealName;
CElementInformation ElemInfo;
ElemInfo.SetTagName(L"a");
ElemInfo.AddElementAttribute(L"href",L"/admin/std/info",TRUE);
CElementInformation *pParentInfo = ElemInfo.CreateParentInfo();
pParentInfo->SetTagName(L"span");
pParentInfo->AddElementAttribute(L"class",L"user-title",TRUE);
CElemRectList ElemList;
AutoBrowser.GetAllMatchElemRect(&ElemList,&ElemInfo);
if (ElemList.GetElemRectCount() == 1)
{
ELEM_RECT ElemRect;
ElemList.GetElemRectByIndex(0,&ElemRect);
CComQIPtr<IHTMLElement> pElem;
ElemRect.pElem->QueryInterface(IID_IHTMLElement,(void **)&pElem);
if (pElem)
{
CComBSTR bstrInnerText;
pElem->get_innerText(&bstrInnerText);
strUserRealName = bstrInnerText;
}
}
//.........这里部分代码省略.........
示例2: newShape
long shape_extractor::at(size_t i, IGeometry **ppNewGeom)
{
if (m_gt == esriGeometryNull)
return S_FALSE;
CComQIPtr<IGeometry> ipNewShape;
if (m_gt == esriGeometryPoint)
{
HRESULT hr = newShape(m_gt, m_ipSR, m_hasZ, m_hasM, &ipNewShape);
if (hr != S_OK)
return showError<true>(L"create new geometry failed"), hr;
CComQIPtr<IPoint> ipPoint(ipNewShape);
double x, y, z, m;
if (m_as_matrix)
{
ATLASSERT(Rf_isMatrix(m_shape));
size_t r = m_len;//INTEGER(dims)[0];
x = REAL(m_shape)[i];
y = REAL(m_shape)[i + r];
if (m_hasZ || m_hasM)
{
m = z = REAL(m_shape)[i + (r*2)];
if (m_hasZ && m_hasM)
m = REAL(m_shape)[i + (r*3)];
}
}
else
{
x = REAL(m_parts[0])[i];
y = REAL(m_parts[1])[i];
if (m_hasZ || m_hasM)
{
double z, m;
m = z = REAL(m_parts[2])[i];
if (m_hasZ && m_hasM)
m = REAL(m_parts[3])[i];
}
}
ipPoint->PutCoords(x, y);
if (m_hasZ) ipPoint->put_Z(z);
if (m_hasM) ipPoint->put_M(m);
return ipNewShape.CopyTo(ppNewGeom);
}
SEXP it = 0;
tools::vectorGeneric geometry(m_shape);
HRESULT hr = newShape(m_gt, m_ipSR, false, false, &ipNewShape);
if (hr != S_OK)
return showError<true>(L"create new geometry failed"), hr;
it = geometry.at(i);
if (Rf_isNull(it))
{
ipNewShape->SetEmpty();
}
else
{
HRESULT hr = S_FALSE;
if (TYPEOF(it) == NILSXP || Rf_isNumeric(it))
hr = ipNewShape->SetEmpty();
else
{
std::vector<BYTE> buff;
if (!tools::copy_to(it, buff))
return showError<false>(L"unknown structure"), E_FAIL;
CComQIPtr<IESRIShape2> ipShape(ipNewShape);
long buffSize = (long)buff.size();
hr = ipShape->ImportFromESRIShapeEx(esriShapeImportNoSwap | esriShapeImportNonTrusted, &buffSize, &buff[0]);
}
if (hr != S_OK)
return showError<true>(L"create new geometry"), hr;
}
return ipNewShape.CopyTo(ppNewGeom);
}
示例3: ImportLibrary
static IOResult ImportLibrary(ILoad* iload, MtlBaseLib& lib)
{
// Get the VIZ Importer/Exporter
CComPtr<IVIZPointerClient> pPointerClient;
HRESULT hr = CMaxMaterialCollection::GetXMLImpExp(&pPointerClient);
if(hr != S_OK)
return IO_ERROR;
// Get the export interface
CComQIPtr<IXmlMaterial> pIMtl = pPointerClient;
ATLASSERT(pIMtl);
if(!pIMtl)
return IO_ERROR;
// Create an XML document
CComPtr<IXMLDOMDocument> doc;
hr = doc.CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER);
if (hr != S_OK || doc == NULL)
return IO_ERROR;
char* xmlStr = NULL;
IOResult res = iload->ReadCStringChunk(&xmlStr);
if (res != IO_OK)
return res;
if (xmlStr == NULL)
return IO_OK;
_bstr_t xml(xmlStr);
VARIANT_BOOL result;
hr = doc->loadXML(xml.GetBSTR(), &result);
if (hr != S_OK || result == 0)
return IO_ERROR;
CComBSTR query = "./Materials/Material";
CComPtr<IXMLDOMNodeList> list;
hr = doc->selectNodes(query, &list);
if (hr != S_OK || list == NULL)
return IO_ERROR;
long i, len = 0;
hr = list->get_length(&len);
if (hr != S_OK)
return IO_ERROR;
long failed = 0;
for (i = 0; i < len ; ++i) {
CComPtr<IXMLDOMNode> node;
hr = list->get_item(i, &node);
if (hr == S_OK && node != NULL) {
VARIANT vResult;
vResult.vt = VT_BYREF;
vResult.byref = NULL;
hr = pIMtl->ImportMaterial(node, &vResult);
if(SUCCEEDED(hr) && vResult.vt == VT_BYREF && vResult.byref != NULL)
{
lib.Add(static_cast<Mtl*>(vResult.byref));
}
else
++failed;
}
}
return failed == 0 ? IO_OK : IO_ERROR;
}
示例4:
bool CFGFilterLAVAudio::Settings::SetSettings(CComQIPtr<ILAVAudioSettings> pLAVFSettings)
{
if (!pLAVFSettings) {
return false;
}
pLAVFSettings->SetTrayIcon(bTrayIcon);
pLAVFSettings->SetDRC(bDRCEnabled, iDRCLevel);
pLAVFSettings->SetDTSHDFraming(bDTSHDFraming);
pLAVFSettings->SetAutoAVSync(bAutoAVSync);
pLAVFSettings->SetExpandMono(bExpandMono);
pLAVFSettings->SetExpand61(bExpand61);
pLAVFSettings->SetOutputStandardLayout(bOutputStandardLayout);
pLAVFSettings->SetMixingEnabled(bMixingEnabled);
pLAVFSettings->SetMixingLayout(dwMixingLayout);
pLAVFSettings->SetMixingFlags(dwMixingFlags);
pLAVFSettings->SetMixingMode((LAVAudioMixingMode)dwMixingMode);
pLAVFSettings->SetMixingLevels(dwMixingCenterLevel, dwMixingSurroundLevel, dwMixingLFELevel);
pLAVFSettings->SetAudioDelay(bAudioDelayEnabled, iAudioDelay);
for (int i = 0; i < Bitstream_NB; ++i) {
pLAVFSettings->SetBitstreamConfig((LAVBitstreamCodec)i, bBitstream[i]);
}
for (int i = 0; i < SampleFormat_Bitstream; ++i) {
pLAVFSettings->SetSampleFormat((LAVAudioSampleFormat)i, bSampleFormats[i]);
}
pLAVFSettings->SetSampleConvertDithering(bSampleConvertDither);
// The internal LAV Audio Decoder will not be registered to handle WMA formats
// since the system decoder is preferred. However we can still enable those
// formats internally so that they are used in low-merit mode.
pLAVFSettings->SetFormatConfiguration(Codec_WMA2, TRUE);
pLAVFSettings->SetFormatConfiguration(Codec_WMAPRO, TRUE);
pLAVFSettings->SetFormatConfiguration(Codec_WMALL, TRUE);
// Custom interface available only in patched build, will be removed after it's upstreamed
if (CComQIPtr<ILAVAudioSettingsMPCHCCustom> pLAVFSettingsMPCHCCustom = pLAVFSettings) {
pLAVFSettingsMPCHCCustom->SetPropertyPageCallback(PropertyPageCallback);
}
return true;
}
示例5: Muxer
void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
{
CString muxer;
muxer.Format(_T("DSM Muxer (%s)"), CString(__TIMESTAMP__));
SetProperty(L"MUXR", CStringW(muxer));
SetProperty(L"DATE", CStringW(CTime::GetCurrentTime().FormatGmt(_T("%Y-%m-%d %H:%M:%S"))));
MuxFileInfo(pBS);
POSITION pos = m_pPins.GetHeadPosition();
while (pos) {
CBaseMuxerInputPin* pPin = m_pPins.GetNext(pos);
const CMediaType& mt = pPin->CurrentMediaType();
ASSERT((mt.lSampleSize >> 30) == 0); // you don't need >1GB samples, do you?
MuxPacketHeader(pBS, DSMP_MEDIATYPE, 5 + sizeof(GUID) * 3 + mt.FormatLength());
pBS->BitWrite(pPin->GetID(), 8);
pBS->ByteWrite(&mt.majortype, sizeof(mt.majortype));
pBS->ByteWrite(&mt.subtype, sizeof(mt.subtype));
pBS->BitWrite(mt.bFixedSizeSamples, 1);
pBS->BitWrite(mt.bTemporalCompression, 1);
pBS->BitWrite(mt.lSampleSize, 30);
pBS->ByteWrite(&mt.formattype, sizeof(mt.formattype));
pBS->ByteWrite(mt.Format(), mt.FormatLength());
MuxStreamInfo(pBS, pPin);
}
// resources & chapters
CInterfaceList<IDSMResourceBag> pRBs;
pRBs.AddTail(this);
CComQIPtr<IDSMChapterBag> pCB = (IUnknown*)(INonDelegatingUnknown*)this;
pos = m_pPins.GetHeadPosition();
while (pos) {
for (CComPtr<IPin> pPin = m_pPins.GetNext(pos)->GetConnected(); pPin; pPin = GetUpStreamPin(GetFilterFromPin(pPin))) {
if (m_fAutoRes) {
CComQIPtr<IDSMResourceBag> pPB = GetFilterFromPin(pPin);
if (pPB && !pRBs.Find(pPB)) {
pRBs.AddTail(pPB);
}
}
if (m_fAutoChap) {
if (!pCB || pCB->ChapGetCount() == 0) {
pCB = GetFilterFromPin(pPin);
}
}
}
}
// resources
pos = pRBs.GetHeadPosition();
while (pos) {
IDSMResourceBag* pRB = pRBs.GetNext(pos);
for (DWORD i = 0, j = pRB->ResGetCount(); i < j; i++) {
CComBSTR name, desc, mime;
BYTE* pData = NULL;
DWORD len = 0;
if (SUCCEEDED(pRB->ResGet(i, &name, &desc, &mime, &pData, &len, NULL))) {
CStringA utf8_name = UTF16To8(name);
CStringA utf8_desc = UTF16To8(desc);
CStringA utf8_mime = UTF16To8(mime);
MuxPacketHeader(pBS, DSMP_RESOURCE,
1 +
utf8_name.GetLength() + 1 +
utf8_desc.GetLength() + 1 +
utf8_mime.GetLength() + 1 +
len);
pBS->BitWrite(0, 2);
pBS->BitWrite(0, 6); // reserved
pBS->ByteWrite(utf8_name, utf8_name.GetLength() + 1);
pBS->ByteWrite(utf8_desc, utf8_desc.GetLength() + 1);
pBS->ByteWrite(utf8_mime, utf8_mime.GetLength() + 1);
pBS->ByteWrite(pData, len);
CoTaskMemFree(pData);
}
}
}
// chapters
if (pCB) {
CAtlList<CDSMChapter> chapters;
REFERENCE_TIME rtPrev = 0;
int len = 0;
pCB->ChapSort();
for (DWORD i = 0; i < pCB->ChapGetCount(); i++) {
CDSMChapter c;
//.........这里部分代码省略.........
示例6: GetMicArrayGeometry
///////////////////////////////////////////////////////////////////////////////
// Function:
// GetMicArrayGeometry()
//
// Description:
// Obtains the geometry for the specified mic array.
//
// Parameters: szDeviceId -- The requested device ID, which can be obtained
// from calling EnumAudioCaptureDevices()
//
// ppGeometry -- Address of the pointer to the mic-array gemometry.
// Caller is ressponsible for calling CoTaskMemFree()
// if the call is successfull.
//
// cbSize -- size of the geometry structure
//
// Returns: S_OK on success
///////////////////////////////////////////////////////////////////////////////
HRESULT GetMicArrayGeometry(wchar_t szDeviceId[], KSAUDIO_MIC_ARRAY_GEOMETRY** ppGeometry, ULONG& cbSize)
{
HRESULT hr = S_OK;
if (szDeviceId == NULL)
return E_INVALIDARG;
if (ppGeometry == NULL)
return E_POINTER;
cbSize = 0;
CComPtr<IMMDeviceEnumerator> spEnumerator;
CComPtr<IMMDevice> spDevice;
CComQIPtr<IPart> spPart;
bool bIsMicArray;
hr = spEnumerator.CoCreateInstance(__uuidof(MMDeviceEnumerator));
IF_FAILED_RETURN(hr);
hr = spEnumerator->GetDevice(szDeviceId, &spDevice);
IF_FAILED_RETURN(hr);
hr = EndpointIsMicArray(spDevice, bIsMicArray);
IF_FAILED_RETURN(hr);
if (!bIsMicArray)
return E_FAIL;
UINT nPartId = 0;
hr = GetInputJack(spDevice, spPart);
IF_FAILED_RETURN(hr);
hr = spPart->GetLocalId(&nPartId);
IF_FAILED_RETURN(hr);
CComPtr<IDeviceTopology> spTopology;
CComPtr<IMMDeviceEnumerator> spEnum;
CComPtr<IMMDevice> spJackDevice;
CComPtr<IKsControl> spKsControl;
wchar_t * pwstrDevice = 0;
// Get the topology object for the part
hr = spPart->GetTopologyObject(&spTopology);
IF_FAILED_RETURN(hr);
// Get the id of the IMMDevice that this topology object describes.
hr = spTopology->GetDeviceId(&pwstrDevice);
IF_FAILED_RETURN(hr);
// Get an IMMDevice pointer using the ID
hr = spEnum.CoCreateInstance(__uuidof(MMDeviceEnumerator));
IF_FAILED_JUMP(hr, Exit);
hr = spEnum->GetDevice(pwstrDevice, &spJackDevice);
IF_FAILED_JUMP(hr, Exit);
// Activate IKsControl on the IMMDevice
hr = spJackDevice->Activate(__uuidof(IKsControl), CLSCTX_INPROC_SERVER,
NULL, reinterpret_cast<void**>(&spKsControl));
IF_FAILED_JUMP(hr, Exit);
// At this point we can use IKsControl just as we would use DeviceIoControl
KSP_PIN ksp;
ULONG cbData = 0;
ULONG cbGeometry = 0;
// Inititialize the pin property
::ZeroMemory(&ksp, sizeof(ksp));
ksp.Property.Set = KSPROPSETID_Audio;
ksp.Property.Id = KSPROPERTY_AUDIO_MIC_ARRAY_GEOMETRY;
ksp.Property.Flags = KSPROPERTY_TYPE_GET;
ksp.PinId = nPartId & PARTID_MASK;
// Get data size by passing NULL
hr = spKsControl->KsProperty(reinterpret_cast<PKSPROPERTY>(&ksp),
sizeof(ksp), NULL, 0, &cbGeometry);
IF_FAILED_JUMP(hr, Exit);
// Allocate memory for the microphone array geometry
*ppGeometry = reinterpret_cast<KSAUDIO_MIC_ARRAY_GEOMETRY*>
(::CoTaskMemAlloc(cbGeometry));
if(*ppGeometry == 0)
//.........这里部分代码省略.........
示例7: StartClassify
void StartClassify(const CComBSTR & scriptText)
{
clib::recursive_mutex::scoped_lock proc(m_mutex);
if (m_classified)
{
proc.unlock();
on_refresh(this, EVENT_CLASSIFIED);
return;
}
m_classified = true;
ClassifyStructVector request;
//Process Main Frame
InsertScript(m_doc, scriptText);
PrepRequest(m_doc, request);
//Process Child Frames
CComQIPtr<IOleContainer> pContainer = m_doc;
if (!pContainer)
return;
CComPtr<IEnumUnknown> pEnumerator;
HRESULT hr = pContainer->EnumObjects(OLECONTF_EMBEDDINGS, &pEnumerator);
if (FAILED(hr))
return;
CComPtr<IUnknown> pUnk;
ULONG uFetched;
for (UINT i = 0; S_OK == pEnumerator->Next(1, &pUnk, &uFetched); i++)
{
CComQIPtr<IWebBrowser2> pBrowser = pUnk;
if (pBrowser)
{
CComPtr<IDispatch> spDispDoc;
HRESULT hr = pBrowser->get_Document(&spDispDoc);
if (SUCCEEDED(hr))
{
// ...and query for an HTML document.
CComQIPtr<IHTMLDocument> spHTMLDoc = spDispDoc;
if (spHTMLDoc)
{
InsertScript(spHTMLDoc, scriptText);
PrepRequest(spHTMLDoc, request);
}
}
}
pUnk.Release();
}
m_classifyThreads.SetMaxThreadCount(0);
ClassifyStructVector batchRequest;
int textLen = 0;
for(ClassifyStructVector::iterator itr = request.begin(); itr != request.end(); ++itr)
{
textLen += itr->text.length();
batchRequest.push_back(*itr);
if (textLen > BATCH_SIZE)
{
m_classifyThreads.Append(__FUNCTION__, boost::bind(&threadClassify, this, batchRequest));
batchRequest.clear();
textLen = 0;
}
}
if (batchRequest.size())
{
m_classifyThreads.Append(__FUNCTION__, boost::bind(&threadClassify, this, batchRequest));
batchRequest.clear();
}
m_classifyThreads.SetMaxThreadCount(THREAD_COUNT);
//int textLen = 0;
//BOOL finished = false;
//HRESULT hr = S_OK;
//while(hr == S_OK && !finished)
//{
// MARKUP_CONTEXT_TYPE pContext = CONTEXT_TYPE_None;
// long pcch = -1;
// prev->MoveToPointer(finger);
// hr = finger->Right(true, &pContext, NULL, &pcch, NULL);
// if (pContext == CONTEXT_TYPE_Text && pcch > 1)
// {
// ClassifyStruct newItem;
// newItem.text.resize(pcch);
// prev->Right(false, NULL, NULL, &pcch, &newItem.text[0]);
// std::wstring testStr = newItem.text;
// boost::algorithm::trim(testStr);
// if (testStr.length())
// {
// markupServices->CreateMarkupPointer(&newItem.textNode);
// newItem.textNode->MoveToPointer(prev);
// request.push_back(newItem);
// textLen += pcch;
// if (textLen > 1000)
// {
// m_classifyThreads.Append(__FUNCTION__, boost::bind(&threadClassify, this, request));
// request.clear();
// textLen = 0;
// }
// }
// }
// finger->IsRightOfOrEqualTo(end, &finished);
//.........这里部分代码省略.........
示例8: OnSymbolDefineSymbol
LRESULT CSVGSymbolsDlg::OnSymbolDefineSymbol(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
CComPtr<IEXMLDocument> eXMLDocument;
m_viewGroup->get_eXMLDocument(&eXMLDocument);
CComQIPtr<IEDocument> eDocument = eXMLDocument;
CComPtr<ILDOMDocument> document;
eXMLDocument->get_DOMDocument(&document);
CSVGFilterOptionsDlg dlg;
dlg.m_document = document;
if (dlg.DoModal() == IDOK)
{
CComPtr<IOleUndoManager> undoManager;
eDocument->get_undoManager(&undoManager);
CComObject<CUndoParent>* pParentUndo;
CComObject<CUndoParent>::CreateInstance(&pParentUndo);
if (pParentUndo)
{
pParentUndo->AddRef(); // ???
undoManager->Open(pParentUndo);
CComPtr<ILSVGElement> svgDefsElement;
eXMLDocument->FindOrCreateSVGDefs(&svgDefsElement);
if (svgDefsElement)
{
CComPtr<ILSVGSymbolElement> svgFilterElement;
document->createElementNS(L"http://www.w3.org/2000/svg", L"symbol", (ILDOMElement**)&svgFilterElement);
if (svgFilterElement)
{
svgFilterElement->setAttribute(L"id", dlg.m_id);
{
double minx = 99999999;
double miny = 99999999;
double maxx = -99999999;
double maxy = -99999999;
for (int i = 0; i < m_viewGroup->m_targetElements.GetSize(); i++)
{
CComPtr<IEElement> eElement;
m_viewGroup->m_targetElements[i]->get_eElement(&eElement);
CComPtr<ILDOMElement> element;
eElement->get_domElement(&element);
CComQIPtr<ILSVGLocatable> locatable = element;
if (locatable)
{
CComPtr<ILSVGRect> svgrect;
locatable->getBBox(&svgrect);
SVGRect rect = svgrect;
minx = min(minx, rect.X);
miny = min(miny, rect.Y);
maxx = max(maxx, rect.X+rect.Width);
maxy = max(maxy, rect.Y+rect.Height);
CComPtr<ILDOMNode> clone;
element->cloneNode(VARIANT_TRUE/*bDeep*/, &clone);
svgFilterElement->appendChild(clone, NULL);
}
}
WCHAR viewBox[256];
swprintf(viewBox, L"%g %g %g %g", minx, miny, maxx-minx, maxy-miny);
svgFilterElement->setAttribute(L"viewBox", viewBox);
}
//CComPtr<IOleUndoManager> undoManager;
//m_document->get_undoManager(&undoManager);
CComObject<CWEUndoNewElement>* pUndo;
CComObject<CWEUndoNewElement>::CreateInstance(&pUndo);
if (pUndo)
{
// pUndo->AddRef();
pUndo->m_pDocument = static_cast<CEXMLDocument*>(eXMLDocument.p);
pUndo->DoInitial(undoManager, svgFilterElement, svgDefsElement, NULL);
{
CEXMLViewGroup* pViewGroup = static_cast<CEXMLViewGroup*>(m_viewGroup);
CComPtr<IEElement> eElement;
eXMLDocument->GetEElementFromDOMElement(svgFilterElement, &eElement);
pViewGroup->m_activeReferencedElement = eElement; // ??? reference element is still NULL
m_viewGroup->ActivateElement(eElement, 0, NULL);
}
}
}
}
undoManager->Close(pParentUndo, TRUE/*commit*/);
//.........这里部分代码省略.........
示例9: while
LRESULT CSVGSymbolsDlg::OnBreakLinkToSymbol(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
if (m_viewGroup->m_pActiveElement)
{
CComPtr<IEElement> eElement;
m_viewGroup->m_pActiveElement->get_eElement(&eElement);
CComPtr<ILDOMElement> domElement;
eElement->get_domElement(&domElement);
CComQIPtr<ILSVGUseElement> useElement = domElement;
if (useElement)
{
CComPtr<ILDOMDocument> document;
m_viewGroup->m_pDocument->get_DOMDocument(&document);
CComQIPtr<ILSVGURIReference> uriReference = useElement;
CComPtr<ILSVGAnimatedString> a;
uriReference->get_href(&a);
CComBSTR uri;
a->get_baseVal(&uri);
BSTR id = &((BSTR)uri)[1];
CComPtr<ILDOMElement> refElement;
document->getElementById(id, &refElement);
CComQIPtr<ILSVGSymbolElement> symbolElement = refElement;
if (symbolElement)
{
CComPtr<ILDOMElement> gElement;
document->createElementNS(L"http://www.w3.org/2000/svg", L"g", &gElement);
if (gElement)
{
CComPtr<ILDOMElement> svgElement;
document->createElementNS(L"http://www.w3.org/2000/svg", L"svg", &svgElement);
if (svgElement)
{
CComBSTR viewBox;
symbolElement->getAttribute(L"viewBox", &viewBox);
svgElement->setAttribute(L"viewBox", viewBox);
//symbolElement->getAttribute(L"style", &viewBox);
CComBSTR width;
CComBSTR height;
useElement->getAttribute(L"width", &width);
useElement->getAttribute(L"height", &height);
if (width != NULL)
svgElement->setAttribute(L"width", width);
else
svgElement->setAttribute(L"width", L"100%");
if (height != NULL)
svgElement->setAttribute(L"height", height);
else
svgElement->setAttribute(L"height", L"100%");
CComPtr<ILDOMNode> node;
symbolElement->get_firstChild(&node);
while (node)
{
CComQIPtr<ILDOMElement> element = node;
if (element)
{
CComPtr<ILDOMNode> clone;
element->cloneNode(VARIANT_TRUE/*bDeep*/, &clone);
svgElement->appendChild(clone, NULL);
}
CComPtr<ILDOMNode> nextSibling;
node->get_nextSibling(&nextSibling);
node = nextSibling;
}
gElement->appendChild(svgElement, NULL);
}
CComPtr<ILDOMNode> parentNode;
useElement->get_parentNode(&parentNode);
CComPtr<ILDOMNode> p;
parentNode->replaceChild(gElement, useElement, &p);
}
}
}
}
return 0;
}
示例10: ASSERT
STDMETHODIMP CSVGSymbolsDlg::Drop(IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect)
{
ASSERT(0);
#if 0
POINT point;
point.x = pt.x;
point.y = pt.y;
ScreenToClient(&point);
COleDataObjectWrapper dataObject;
dataObject.Attach(pDataObject);
HGLOBAL hData;
#if 0
if (hData = dataObject.GetGlobalData(CF_HDROP))
{
DROPFILES* dp = (DROPFILES*)GlobalLock(hData);
if (dp)
{
char* p = (char*)(dp+1);
int i = 0;
TCHAR filename[512];
while (*p)
{
filename[i++] = *p++;
}
filename[i] = 0;
CHTMDesignFrame* pFrame = NULL;
m_pFrameSet->OnButtonDown(0, point, 0, FALSE, &pFrame);
if (pFrame)
{
pFrame->m_pElement->setAttribute(L"src", _bstr_t(filename));
//m_pDocument->CreateHTMLTree();
//m_pDocument->UpdateAllViews(NULL);
}
}
GlobalUnlock(hData);
{
BuildFrames();
OnSize();
InvalidateRect(NULL, TRUE);
}
*pdwEffect = DROPEFFECT_COPY;
}
else
#endif
if (hData = dataObject.GetGlobalData(CF_UNICODETEXT))
{
WCHAR* text = (WCHAR*)GlobalLock(hData);
int len = GlobalSize(hData);
CComPtr<ILSVGDocument> svgdocument;
svgdocument.CoCreateInstance(CLSID_LSVGDocument);
VARIANT_BOOL bsuccess;
svgdocument->loadXML(_bstr_t(text), &bsuccess);
if (bsuccess)
{
CComQIPtr<IEDocument> eDocument = m_viewGroup->m_pDocument;
CComPtr<IOleUndoManager> undoManager;
eDocument->get_undoManager(&undoManager);
CComObject<CUndoParent>* pParentUndo;
CComObject<CUndoParent>::CreateInstance(&pParentUndo);
if (pParentUndo)
{
pParentUndo->AddRef(); // ???
undoManager->Open(pParentUndo);
CComPtr<ILSVGElement> svgDefsElement;
m_viewGroup->m_pDocument->FindOrCreateSVGDefs(&svgDefsElement);
if (svgDefsElement)
{
CComPtr<ILDOMElement> documentElement;
svgdocument->get_documentElement(&documentElement);
CComPtr<ILDOMNode> node;
documentElement->get_firstChild(&node);
while (node)
{
CComPtr<ILDOMNode> nextSibling;
node->get_nextSibling(&nextSibling);
CComQIPtr<ILSVGSymbolElement> svgSymbolElement = node;
if (svgSymbolElement)
{
m_listView.m_xmlDocument->adoptNode(svgSymbolElement, NULL);
CComObject<CWEUndoNewElement>* pUndo;
CComObject<CWEUndoNewElement>::CreateInstance(&pUndo);
//.........这里部分代码省略.........
示例11: GetWebBrowserDisp
IDispatch* WizardApp::GetWebBrowserDisp()
{
CComQIPtr<IDispatch> spDisp = m_spWebDisp;
return spDisp.Detach();
}
示例12: if
CComPtr<IUIDlg> CEColorDlg::CreateColorPicker(int nColorPicker)
{
CComPtr<IUIDlg> colorDlg;
if (nColorPicker == 0)
{
/*
CComObject<CColorPickerGrayscaleDlg>* p;
CComObject<CColorPickerGrayscaleDlg>::CreateInstance(&p);
if (p)
{
colorDlg = p;
}
*/
}
else if (nColorPicker == 1)
{
CComObject<CRGBSlidersDlg>* p;
CComObject<CRGBSlidersDlg>::CreateInstance(&p);
if (p)
{
colorDlg = p;
}
}
else if (nColorPicker == 2)
{
CComObject<CHSLColorWheelDlg>* p;
CComObject<CHSLColorWheelDlg>::CreateInstance(&p);
if (p)
{
colorDlg = p;
}
}
else if (nColorPicker == 3)
{
CComObject<CNamedColorsDlg>* p;
CComObject<CNamedColorsDlg>::CreateInstance(&p);
if (p)
{
colorDlg = p;
}
}
else
ASSERT(0);
if (colorDlg)
{
CComQIPtr<IEColorPicker> colorpicker = colorDlg;
if (colorpicker)
{
colorpicker->SetSite(this);
colorDlg->Create(m_hWnd);
HWND hWnd;
colorDlg->get_hwnd(&hWnd);
if (hWnd)
{
::ShowWindow(hWnd, SW_SHOW);
return colorDlg;
}
}
}
return NULL;
}
示例13: ATLASSERT
STDMETHODIMP CESVGRectElement::Move(ISVGView* view, double dx, double dy)
{
ATLASSERT(0);
#if 0
CComQIPtr<ILSVGRectElement> rect = m_domElement;
CComPtr<ILHTMLWindow> window;
view->GetHTMLWindow(&window);
CComPtr<ILSVGElement> viewportElement;
rect->get_viewportElement(&viewportElement);
// TODO, this can't be correct
CComPtr<ILSVGRect> _rect;
window->svgGetRBBox(viewportElement, &_rect);
SVGRect viewBox = _rect;
// x
{
CComPtr<ILSVGAnimatedLength> alength;
rect->get_x(&alength);
SVGLength length;
alength->get_baseVal(&length);
if (length.GetUnitType() == SVG_LENGTHTYPE_PERCENTAGE)
{
double dx_pcnt = dx*100/viewBox.Width;
double value;
length->get_valueInSpecifiedUnits(&value);
length->put_valueInSpecifiedUnits(value+dx_pcnt);
}
else
{
double value;
length->get_value(&value);
length->put_value(value + dx);
}
}
// y
{
CComPtr<ILSVGAnimatedLength> alength;
rect->get_y(&alength);
SVGLength length;
alength->get_baseVal(&length);
if (length.GetUnitType() == SVG_LENGTHTYPE_PERCENTAGE)
{
double dy_pcnt = dy*100/viewBox.Height;
double value;
length->get_valueInSpecifiedUnits(&value);
length->put_valueInSpecifiedUnits(value+dy_pcnt);
}
else
{
double value;
length->get_value(&value);
length->put_value(value + dy);
}
}
#endif
return S_OK;
}
示例14: GetPartFilename
LPCTSTR CBaseSplitterFilter::GetPartFilename(IAsyncReader* pAsyncReader)
{
CComQIPtr<IFileHandle> pFH = pAsyncReader;
return pFH ? pFH->GetFileName() : m_fn;
}
示例15: CoTaskMemFree
bool CFGFilterLAVSplitterBase::Settings::GetSettings(CComQIPtr<ILAVFSettings> pLAVFSettings)
{
if (!pLAVFSettings) {
return false;
}
bTrayIcon = pLAVFSettings->GetTrayIcon();
HRESULT hr;
LPWSTR lpwstr = nullptr;
hr = pLAVFSettings->GetPreferredLanguages(&lpwstr);
if (SUCCEEDED(hr) && lpwstr) {
prefAudioLangs = lpwstr;
CoTaskMemFree(lpwstr);
}
lpwstr = nullptr;
hr = pLAVFSettings->GetPreferredSubtitleLanguages(&lpwstr);
if (SUCCEEDED(hr) && lpwstr) {
prefSubLangs = lpwstr;
CoTaskMemFree(lpwstr);
}
lpwstr = nullptr;
hr = pLAVFSettings->GetAdvancedSubtitleConfig(&lpwstr);
if (SUCCEEDED(hr) && lpwstr) {
subtitleAdvanced = lpwstr;
CoTaskMemFree(lpwstr);
}
subtitleMode = pLAVFSettings->GetSubtitleMode();
bPGSForcedStream = pLAVFSettings->GetPGSForcedStream();
bPGSOnlyForced = pLAVFSettings->GetPGSOnlyForced();
iVC1Mode = pLAVFSettings->GetVC1TimestampMode();
bSubstreams = pLAVFSettings->GetSubstreamsEnabled();
bMatroskaExternalSegments = pLAVFSettings->GetLoadMatroskaExternalSegments();
bStreamSwitchRemoveAudio = pLAVFSettings->GetStreamSwitchRemoveAudio();
bImpairedAudio = pLAVFSettings->GetUseAudioForHearingVisuallyImpaired();
bPreferHighQualityAudio = pLAVFSettings->GetPreferHighQualityAudioStreams();
dwQueueMaxSize = pLAVFSettings->GetMaxQueueMemSize();
dwNetworkAnalysisDuration = pLAVFSettings->GetNetworkStreamAnalysisDuration();
return true;
}