本文整理汇总了C++中COMPtr::initWithFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ COMPtr::initWithFrame方法的具体用法?C++ COMPtr::initWithFrame怎么用?C++ COMPtr::initWithFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COMPtr
的用法示例。
在下文中一共展示了COMPtr::initWithFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createAndInitializeWebView
static void createAndInitializeWebView(COMPtr<IWebView>& outWebView, HostWindow& window, HWND& viewWindow)
{
COMPtr<IWebView> webView;
TEST_ASSERT(SUCCEEDED(WebKitCreateInstance(__uuidof(WebView), &webView)));
TEST_ASSERT(window.initialize());
TEST_ASSERT(SUCCEEDED(webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(window.window()))));
TEST_ASSERT(SUCCEEDED(webView->initWithFrame(window.clientRect(), 0, 0)));
COMPtr<IWebViewPrivate> viewPrivate(Query, webView);
TEST_ASSERT(viewPrivate);
TEST_ASSERT(SUCCEEDED(viewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))));
TEST_ASSERT(IsWindow(viewWindow));
outWebView.adoptRef(webView.releaseRef());
}
示例2: createModalDialog
HRESULT UIDelegate::createModalDialog(_In_opt_ IWebView* sender, _In_opt_ IWebURLRequest*, _COM_Outptr_opt_ IWebView** newWebView)
{
if (!newWebView)
return E_POINTER;
COMPtr<IWebView> webView;
HRESULT hr = WebKitCreateInstance(CLSID_WebView, 0, IID_IWebView, (void**)&webView);
if (FAILED(hr))
return hr;
m_modalDialogParent = ::CreateWindow(L"STATIC", L"ModalDialog", WS_OVERLAPPED | WS_VISIBLE, 0, 0, 0, 0, getHandleFromWebView(sender), nullptr, nullptr, nullptr);
hr = webView->setHostWindow(m_modalDialogParent);
if (FAILED(hr))
return hr;
RECT clientRect = { 0, 0, 0, 0 };
hr = webView->initWithFrame(clientRect, 0, _bstr_t(L""));
if (FAILED(hr))
return hr;
COMPtr<IWebUIDelegate> uiDelegate;
hr = sender->uiDelegate(&uiDelegate);
if (FAILED(hr))
return hr;
hr = webView->setUIDelegate(uiDelegate.get());
if (FAILED(hr))
return hr;
COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;
hr = sender->frameLoadDelegate(&frameLoadDelegate);
if (FAILED(hr))
return hr;
hr = webView.get()->setFrameLoadDelegate(frameLoadDelegate.get());
if (FAILED(hr))
return hr;
*newWebView = webView.leakRef();
return S_OK;
}