本文整理汇总了C++中CActiveXUI类的典型用法代码示例。如果您正苦于以下问题:C++ CActiveXUI类的具体用法?C++ CActiveXUI怎么用?C++ CActiveXUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CActiveXUI类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Notify
void Notify(TNotifyUI& msg)
{
// name = flashUI 控件在UI布局中默认注释掉,查看效果需修改xml
CFlashUI* pFlashUI = static_cast<CFlashUI*>(m_pm.FindControl(_T("flashUI")));
if( msg.sType == _T("click") ) {
if( msg.pSender->GetName() == _T("closebtn") || msg.pSender->GetName() == _T("closebtn2") ) {
PostQuitMessage(0);
return;
}
}
else if ( msg.sType == _T("windowinit"))
{
if ( pFlashUI)
{
pFlashUI->m_pFlash->put_WMode(_bstr_t(_T("Transparent") )); // FlashUI没有实现特定接口,需要完善才能支持
pFlashUI->m_pFlash->put_Movie( _bstr_t(CPaintManagerUI::GetInstancePath() + _T("\\skin\\FlashRes\\test.swf")) );
pFlashUI->m_pFlash->DisableLocalSecurity();
pFlashUI->m_pFlash->put_AllowScriptAccess(L"always");
BSTR request,response;
request = SysAllocString(L"<invoke name=\"setButtonText\" returntype=\"xml\"><arguments><string>Click me!</string></arguments></invoke>");
response = SysAllocString(L"");
pFlashUI->m_pFlash->CallFunction(request, &response);
SysFreeString(request);
SysFreeString(response);
}
}
else if( msg.sType == _T("showactivex") )
{
if( msg.pSender->GetName() == _T("flashActiveX") )
{
IShockwaveFlash* pFlash = NULL;
CActiveXUI* pActiveX = static_cast<CActiveXUI*>(msg.pSender);
pActiveX->GetControl(IID_IUnknown, (void**)&pFlash);
if( pFlash != NULL )
{
pFlash->put_WMode( _bstr_t(_T("Transparent") ) );
pFlash->put_Movie( _bstr_t(CPaintManagerUI::GetInstancePath() + _T("\\skin\\FlashRes\\test.swf")) );
pFlash->DisableLocalSecurity();
pFlash->put_AllowScriptAccess(L"always");
BSTR request,response;
request = SysAllocString(L"<invoke name=\"setButtonText\" returntype=\"xml\"><arguments><string>Click me!</string></arguments></invoke>");
response = SysAllocString(L"");
pFlashUI->m_pFlash->CallFunction(request, &response);
SysFreeString(request);
SysFreeString(response);
}
}
}
}
示例2: Initialize
void RedisHelpUI::Initialize()
{
CActiveXUI* pActiveXUI = static_cast<CActiveXUI*>(GetPaintMgr()->FindControl(_T("ie")));
if( pActiveXUI ) {
IWebBrowser2* pWebBrowser = NULL;
pActiveXUI->GetControl(IID_IWebBrowser2, (void**)&pWebBrowser);
// 忽略js错误
pWebBrowser->put_Silent(true);
if( pWebBrowser != NULL ) {
pWebBrowser->Navigate(L"http://redis.io/commands",NULL,NULL,NULL,NULL);
//pWebBrowser->Navigate(L"about:blank",NULL,NULL,NULL,NULL);
pWebBrowser->Release();
}
}
}
示例3: CenterWindow
void CFrameWnd::InitWindow()
{
// SetIcon(IDR_MAINFRAME); // 设置任务栏图标
CenterWindow();
// 初始化CActiveXUI控件
CActiveXUI* pActiveXUI = static_cast<CActiveXUI*>(m_PaintManager.FindControl(_T("ActiveXDemo1")));
if( pActiveXUI )
{
IWebBrowser2* pWebBrowser = NULL;
pActiveXUI->SetDelayCreate(false); // 相当于界面设计器里的DelayCreate属性改为FALSE,在duilib自带的FlashDemo里可以看到此属性为TRUE
pActiveXUI->CreateControl(CLSID_WebBrowser); // 相当于界面设计器里的Clsid属性里填入{8856F961-340A-11D0-A96B-00C04FD705A2},建议用CLSID_WebBrowser,如果想看相应的值,请见<ExDisp.h>
pActiveXUI->GetControl(IID_IWebBrowser2, (void**)&pWebBrowser);
if( pWebBrowser != NULL )
{
//pWebBrowser->Navigate(L"https://code.google.com/p/duilib/",NULL,NULL,NULL,NULL);
pWebBrowser->Navigate(L"about:blank", NULL, NULL, NULL, NULL);
pWebBrowser->Navigate(L"http://www.baidu.com/", NULL, NULL, NULL, NULL); // 由于谷歌时不时被墙,所以换成反应快的网站
pWebBrowser->Release();
}
}
// 初始化CProgressUI控件
CProgressUI* pProgress = static_cast<CProgressUI*>(m_PaintManager.FindControl(_T("ProgressDemo1")));
pProgress->SetValue(50);
// 初始化CListUI控件
CDuiString str;
CListUI* pList = static_cast<CListUI*>(m_PaintManager.FindControl(_T("ListDemo1")));
for (int i = 0; i < 100; i++)
{
CListTextElementUI* pListElement = new CListTextElementUI;
pListElement->SetTag(i);
pList->Add(pListElement);
str.Format(_T("%d"), i);
pListElement->SetText(0, str);
pListElement->SetText(1, _T("haha"));
}
}
示例4: Notify
void Notify(TNotifyUI& msg)
{
if( msg.sType == _T("click") ) {
if( msg.pSender->GetName() == _T("closebtn") || msg.pSender->GetName() == _T("closebtn2") ) {
PostQuitMessage(0);
return;
}
}
else if( msg.sType == _T("showactivex") ) {
if( msg.pSender->GetName() != _T("flash") ) return;
IShockwaveFlash* pFlash = NULL;
CActiveXUI* pActiveX = static_cast<CActiveXUI*>(msg.pSender);
pActiveX->GetControl(IID_IUnknown, (void**)&pFlash);
if( pFlash != NULL ) {
pFlash->put_WMode( _bstr_t(_T("Transparent") ) );
pFlash->put_Movie( _bstr_t(CPaintManagerUI::GetInstancePath() + _T("\\skin\\FlashRes\\test.swf")) );
pFlash->DisableLocalSecurity();
pFlash->put_AllowScriptAccess(L"always");
BSTR response;
pFlash->CallFunction(L"<invoke name=\"setButtonText\" returntype=\"xml\"><arguments><string>Click me!</string></arguments></invoke>", &response);
pFlash->Release();
}
}
}
示例5: PostQuitMessage
void CMainDialog::OnClick( CControlUI* pSender)
{
if (pSender->GetName() == TEXT ("btnExit")) {
PostQuitMessage(0);
return;
}
else if (pSender->GetName() == _T ("btnTip")) {
CControlUI* pbtnTip = static_cast <CControlUI*> (m_pm.FindControl(_T ("btnTip")));
if (pbtnTip) {
pbtnTip->SetVisible(false);
}
CEditUI* peditSearch = static_cast <CEditUI*> (m_pm.FindControl(_T ("editSearch")));
if (peditSearch != NULL) {
peditSearch->SetFocus();
}
}
else if (pSender->GetName() == _T ("lstDelButton")) {
int iIndex = 0;
CMyList* pParent = static_cast <CMyList*> (pSender->GetParent()->GetParent());
if (pParent) {
iIndex = pParent->GetItemIndex(pSender->GetParent());
}
CDuiString str;
str.Format(_T ("您要删除 %d 项"), iIndex);
if (IDNO == MessageBox (GetHWND (), str, NULL, MB_OK | MB_YESNO)) return;
CMyList* pList = static_cast <CMyList*> (m_pm.FindControl(_T ("lstControl")));
ASSERT(pList);
if (pList) {
pList->RemoveAt(iIndex);
CControlUI* pItem = pList->GetItemAt(iIndex+5);
if (pItem) {
const RECT& rc = pItem->GetPos();
SIZE sz = {0, rc.top};
pList->SetScrollPos(sz);
}
}
}
else if (pSender->GetName() == _T ("btnAddComboItem")) {
CComboUI* pcbx = static_cast <CComboUI*> (m_pm.FindControl(_T ("combo1")));
assert (pcbx);
if (pcbx) {
CListLabelElementUI* pItem = new CListLabelElementUI ();
pItem->SetText(_T ("{b}{i}新加项{/i}{/b}"));
pcbx->Add(pItem);
}
AddComboboxItem();
CComboUI* pcbx2 = static_cast <CComboUI*> (m_pm.FindControl(_T ("combo2")));
}
else if (pSender->GetName() == _T ("btnGoIe")) {
CActiveXUI* pActiveXUI = static_cast<CActiveXUI*>(m_pm.FindControl(_T("ie")));
if( pActiveXUI ) {
IWebBrowser2* pWebBrowser = NULL;
pActiveXUI->GetControl(IID_IWebBrowser2, (void**)&pWebBrowser);
if( pWebBrowser != NULL ) {
CEditUI* pEdit = static_cast <CEditUI*> (m_pm.FindControl(_T ("editIePath")));
ASSERT (pEdit);
CDuiString strIePath = _T ("www.baidu.com");
if (pEdit) {
strIePath = pEdit->GetText();
}
WCHAR szPath [1024] = {0};
#if defined(_UNICODE) || defined(UNICODE)
lstrcpyW (szPath, strIePath);
#else
::MultiByteToWideChar(CP_ACP, 0, strIePath, -1, szPath, 1023);
#endif
pWebBrowser->Navigate(szPath,NULL,NULL,NULL,NULL);
pWebBrowser->Release();
}
}
}
}
示例6: assert
void CQuizWnd::InitWindow()
{
assert(m_songInfo);
CenterWindow();
auto& quizInfo = m_songInfo->GetQuizInfo();
// show title
CTextUI* title = static_cast<CTextUI*>(m_PaintManager.FindControl(L"title"));
if (!title) return;
title->SetText(quizInfo.get_title().c_str());
// show questoins button
CHorizontalLayoutUI* questions_btn = static_cast<CHorizontalLayoutUI*>(m_PaintManager.FindControl(L"questions_btn"));
if (!questions_btn) return;
wchar_t ndx[3] = L"1";
auto cnt = quizInfo.get_quiz_count();
static const int FIXED_LENGTH = 64;
SIZE sz = { 1,1 };
for (auto i = 0; i < cnt; i++) {
CButtonUI* btn = new CButtonUI();
btn->SetName(((wstring)BTN_QUESTION_PREFIX + ndx).c_str());
btn->SetFloat();
btn->SetFixedXY(sz);
btn->SetFixedHeight(FIXED_LENGTH);
btn->SetFixedWidth(FIXED_LENGTH);
btn->SetNormalImage(((wstring)NORMAL_PREFIX + ndx + POSTFIX_PNG).c_str());
btn->SetFocusedImage(((wstring)NORMAL_PREFIX + ndx + POSTFIX_PNG).c_str());
btn->SetHotImage(((wstring)HOT_PREFIX + ndx + POSTFIX_PNG).c_str());
btn->SetPushedImage(((wstring)HOT_PREFIX + ndx + POSTFIX_PNG).c_str());
questions_btn->Add(btn);
ndx[0]++;
sz.cx += FIXED_LENGTH + 1;
if (ndx[0] == 58) {
ndx[0] = L'1';
ndx[1] = L'0';
}
}
// show doen button
if (cnt > 0) {
CButtonUI* btn = new CButtonUI();
btn->SetName(((wstring)BTN_QUESTION_PREFIX + DONE).c_str());
btn->SetFloat();
btn->SetFixedXY(sz);
btn->SetFixedHeight(FIXED_LENGTH);
btn->SetFixedWidth(FIXED_LENGTH);
btn->SetNormalImage(((wstring)NORMAL_PREFIX + DONE + POSTFIX_PNG).c_str());
btn->SetFocusedImage(((wstring)NORMAL_PREFIX + DONE + POSTFIX_PNG).c_str());
btn->SetHotImage(((wstring)HOT_PREFIX + DONE + POSTFIX_PNG).c_str());
btn->SetPushedImage(((wstring)HOT_PREFIX + DONE + POSTFIX_PNG).c_str());
questions_btn->Add(btn);
}
// init question container
CActiveXUI* question = static_cast<CActiveXUI*>(m_PaintManager.FindControl(_T("question")));
if (!question) return;
question->SetDelayCreate(false); // 相当于界面设计器里的DelayCreate属性改为FALSE,在duilib自带的FlashDemo里可以看到此属性为TRUE
question->CreateControl(CLSID_WebBrowser); // 相当于界面设计器里的Clsid属性里填入{8856F961-340A-11D0-A96B-00C04FD705A2},建议用CLSID_WebBrowser,如果想看相应的值,请见<ExDisp.h>
question->GetControl(IID_IWebBrowser2, (void**)&m_question);
assert(m_question);
// show 1st question
ShowQuiz(1);
}
示例7: Play
void CDuiFrameWnd::Notify( TNotifyUI& msg )
{
if (msg.sType == DUI_MSGTYPE_SELECTCHANGED)
{
CTreeViewUI* pTree = static_cast<CTreeViewUI*>(m_PaintManager.FindControl(_T("treePlaylist")));
if(pTree && -1 != pTree->GetItemIndex(msg.pSender) && U_TAG_PLAYLIST == msg.pSender->GetTag())
{
m_iPlaylistIndex = pTree->GetItemIndex(msg.pSender);
Play(m_cPlayList.GetPlaylist(GetPlaylistIndex(m_iPlaylistIndex)).szFileName); //(static_cast<CTreeNodeUI*> (msg.pSender))->GetItemText();
}
}
else if(msg.sType == DUI_MSGTYPE_SELECTCHANGED)
{
CDuiString strName = msg.pSender->GetName();
CTabLayoutUI* pTab = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(_T("tabCaption")));
std::vector<CDuiString> vctString;
vctString.push_back(_T("tabPlay"));
vctString.push_back(_T("tabLib"));
vctString.push_back(_T("tabFind"));
vctString.push_back(_T("tabMine"));
vctString.push_back(_T("tabCloud"));
std::vector<CDuiString>::iterator it = std::find(vctString.begin(), vctString.end(), strName);
if (vctString.end() != it)
{
int iIndex = it - vctString.begin();
pTab->SelectItem(iIndex);
// 加载网页
// 由于加载网页会耗很多内存,所以这里选择动态加载
if (iIndex > 0)
{
std::vector<CDuiString> vctName, vctURL;
CActiveXUI* pActiveXUI;
vctName.push_back(_T("ActiveXLib"));
vctName.push_back(_T("ActiveXFind"));
vctName.push_back(_T("ActiveXMine"));
vctName.push_back(_T("ActiveXCloud"));
vctURL.push_back(_T("http://pianku.xmp.kankan.com/moviestore_index.html"));
vctURL.push_back(_T("http://search.xmp.kankan.com/index4xmp.shtml"));
vctURL.push_back(_T("http://pianku.xmp.kankan.com/xmpguess/host.html"));
vctURL.push_back(_T("http://vod.xunlei.com/page/xmp/home/home.html?init=1"));
iIndex--;
pActiveXUI = static_cast<CActiveXUI*>(m_PaintManager.FindControl(vctName[iIndex]));
if(pActiveXUI)
{
IWebBrowser2* pWebBrowser = NULL;
pActiveXUI->GetControl(IID_IWebBrowser2, (void**)&pWebBrowser);
if(pWebBrowser)
{
_bstr_t bstrTmp;
BSTR bstr;
pWebBrowser->get_LocationURL(&bstr);
bstrTmp.Attach(bstr);
if (! bstrTmp.length())
{
pWebBrowser->Navigate(_bstr_t(vctURL[iIndex]), NULL,NULL,NULL,NULL);
pWebBrowser->Release();
}
}
}
}
}
}
else if(msg.sType == DUI_MSGTYPE_ITEMCLICK)
{
CDuiString strName = msg.pSender->GetName();
if (strName == _T("menuSequence"))
{
m_emPlayMode = EM_PLAY_MODE_SEQUENCE;
}
else if (strName == _T("menuRandom"))
{
m_emPlayMode = EM_PLAY_MODE_RANDOM;
}
else if (strName == _T("menuSingleCircle"))
{
m_emPlayMode = EM_PLAY_MODE_SINGLE_CIRCLE;
}
}
else if( msg.sType == DUI_MSGTYPE_DBCLICK )
{
if (IsInStaticControl(msg.pSender))
{
// 这里会传进来很多次双击消息,所以只获取祖先控件的消息
if (! msg.pSender->GetParent())
{
FullScreen(! m_bFullScreenMode);
}
}
//.........这里部分代码省略.........
示例8: SetIcon
void CDuiFrameWnd::InitWindow()
{
SetIcon(IDI_ICON1);
// 根据分辨率自动调节窗口大小
MONITORINFO oMonitor = {};
oMonitor.cbSize = sizeof(oMonitor);
::GetMonitorInfo(::MonitorFromWindow(*this, MONITOR_DEFAULTTONEAREST), &oMonitor);
AdaptWindowSize(oMonitor.rcMonitor.right - oMonitor.rcMonitor.left);
::GetWindowPlacement(*this, &m_OldWndPlacement);
// 初始化CActiveXUI控件
std::vector<CDuiString> vctName;
CActiveXUI* pActiveXUI;
vctName.push_back(_T("ActiveXLib"));
vctName.push_back(_T("ActiveXFind"));
vctName.push_back(_T("ActiveXMine"));
vctName.push_back(_T("ActiveXCloud"));
for (UINT i = 0; i < vctName.size(); i++)
{
pActiveXUI = static_cast<CActiveXUI*>(m_PaintManager.FindControl(vctName[i]));
if(pActiveXUI)
{
pActiveXUI->SetDelayCreate(false);
pActiveXUI->CreateControl(CLSID_WebBrowser);
}
}
// 几个常用控件做为成员变量
CSliderUI* pSilderVol = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("sliderVol")));
m_pSliderPlay = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("sliderPlay")));
m_pLabelTime = static_cast<CLabelUI*>(m_PaintManager.FindControl(_T("labelPlayTime")));
if (! pSilderVol || ! m_pSliderPlay || ! m_pLabelTime)
{
return;
}
pSilderVol->OnNotify += MakeDelegate(this, &CDuiFrameWnd::OnVolumeChanged);
m_pSliderPlay->OnNotify += MakeDelegate(this, &CDuiFrameWnd::OnPosChanged);
// 设置播放器的窗口句柄和回调函数
CWndUI *pWnd = static_cast<CWndUI*>(m_PaintManager.FindControl(_T("wndMedia")));
if (pWnd)
{
m_cAVPlayer.SetHWND(pWnd->GetHWND());
m_cAVPlayer.SetCallbackPlaying(CallbackPlaying);
m_cAVPlayer.SetCallbackPosChanged(CallbackPosChanged);
m_cAVPlayer.SetCallbackEndReached(CallbackEndReached);
}
// 加载m3u播放列表
AddFiles(m_cPlayList.GetPlaylist(), true);
// 选中上一次播放文件的位置
CTreeViewUI *pTree = static_cast<CTreeViewUI*>(m_PaintManager.FindControl(_T("treePlaylist")));
if (pTree)
{
pTree->SelectItem(m_iPlaylistIndex, true);
}
}
示例9: OnInPlaceActivateEx
STDMETHODIMP CActiveXCtrl::OnInPlaceActivateEx(BOOL* pfNoRedraw, DWORD dwFlags)
{
TRACE(_T("AX: CActiveXCtrl::OnInPlaceActivateEx"));
ASSERT(m_pInPlaceObject==NULL);
if( m_pOwner == NULL ) return E_UNEXPECTED;
if( m_pOwner->m_pUnk == NULL ) return E_UNEXPECTED;
::OleLockRunning(m_pOwner->m_pUnk, TRUE, FALSE);
HWND hWndFrame = m_pOwner->GetManager()->GetPaintWindow();
HRESULT Hr = E_FAIL;
if( (dwFlags & ACTIVATE_WINDOWLESS) != 0 ) {
m_bWindowless = true;
Hr = m_pOwner->m_pUnk->QueryInterface(IID_IOleInPlaceObjectWindowless, (LPVOID*) &m_pInPlaceObject);
m_pOwner->m_hwndHost = hWndFrame;
m_pOwner->GetManager()->AddMessageFilter(m_pOwner);
}
if( FAILED(Hr) ) {
m_bWindowless = false;
Hr = CreateActiveXWnd();
if( FAILED(Hr) ) return Hr;
Hr = m_pOwner->m_pUnk->QueryInterface(IID_IOleInPlaceObject, (LPVOID*) &m_pInPlaceObject);
}
if( m_pInPlaceObject != NULL ) {
CRect rcItem = m_pOwner->m_rcItem;
if( !m_bWindowless ) rcItem.ResetOffset();
m_pInPlaceObject->SetObjectRects(&rcItem, &rcItem);
}
m_bInPlaceActive = SUCCEEDED(Hr);
return Hr;
}
示例10: CreateActiveXWnd
HRESULT CActiveXCtrl::CreateActiveXWnd()
{
if( m_pWindow != NULL ) return S_OK;
m_pWindow = new CActiveXWnd;
if( m_pWindow == NULL ) return E_OUTOFMEMORY;
m_pOwner->m_hwndHost = m_pWindow->Init(this, m_pOwner->GetManager()->GetPaintWindow());
return S_OK;
}
示例11: SetFocus
STDMETHODIMP CActiveXCtrl::SetFocus(BOOL fFocus)
{
TRACE(_T("AX: CActiveXCtrl::SetFocus"));
if( m_pOwner == NULL ) return E_UNEXPECTED;
if( fFocus ) m_pOwner->SetFocus();
m_bFocused = (fFocus == TRUE);
return S_OK;
}
示例12: GetDC
STDMETHODIMP CActiveXCtrl::GetDC(LPCRECT pRect, DWORD grfFlags, HDC* phDC)
{
TRACE(_T("AX: CActiveXCtrl::GetDC"));
if( phDC == NULL ) return E_POINTER;
if( m_pOwner == NULL ) return E_UNEXPECTED;
*phDC = ::GetDC(m_pOwner->m_hwndHost);
if( (grfFlags & OLEDC_PAINTBKGND) != 0 ) {
CRect rcItem = m_pOwner->GetPos();
if( !m_bWindowless ) rcItem.ResetOffset();
::FillRect(*phDC, &rcItem, (HBRUSH) (COLOR_WINDOW + 1));
}
return S_OK;
}
示例13: GetWindowContext
STDMETHODIMP CActiveXCtrl::GetWindowContext(IOleInPlaceFrame** ppFrame, IOleInPlaceUIWindow** ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
{
TRACE(_T("AX: CActiveXCtrl::GetWindowContext"));
if( ppDoc == NULL ) return E_POINTER;
if( ppFrame == NULL ) return E_POINTER;
if( lprcPosRect == NULL ) return E_POINTER;
if( lprcClipRect == NULL ) return E_POINTER;
*ppFrame = new CActiveXFrameWnd(m_pOwner);
*ppDoc = NULL;
ACCEL ac = { 0 };
HACCEL hac = ::CreateAcceleratorTable(&ac, 1);
lpFrameInfo->cb = sizeof(OLEINPLACEFRAMEINFO);
lpFrameInfo->fMDIApp = FALSE;
lpFrameInfo->hwndFrame = m_pOwner->GetManager()->GetPaintWindow();
lpFrameInfo->haccel = hac;
lpFrameInfo->cAccelEntries = 1;
return S_OK;
}
示例14: STDMETHOD
// IOleWindow
STDMETHOD(GetWindow)(HWND* phwnd)
{
if( m_pOwner == NULL ) return E_UNEXPECTED;
*phwnd = m_pOwner->GetManager()->GetPaintWindow();
return S_OK;
}