本文整理汇总了C++中ATLVERIFY函数的典型用法代码示例。如果您正苦于以下问题:C++ ATLVERIFY函数的具体用法?C++ ATLVERIFY怎么用?C++ ATLVERIFY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ATLVERIFY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetClipboardText
void SetClipboardText(const std::wstring& text)
{
if (!::OpenClipboard(::GetDesktopWindow()))
return;
ATLVERIFY(::EmptyClipboard());
const size_t length = (text.size() + 1) * sizeof(text[0]);
HANDLE hmem = ::GlobalAlloc(GMEM_MOVEABLE, length);
UIETWASSERT(hmem); // We are not hardened against OOM.
void* const ptr = ::GlobalLock(hmem);
UIETWASSERT(ptr != NULL);
wcscpy_s(static_cast<wchar_t*>(ptr), (text.size() + 1), text.c_str());
UnlockGlobalMemory(hmem);
if (::SetClipboardData(CF_UNICODETEXT, hmem) == NULL)
{
ATLVERIFY(!::GlobalFree(hmem));
ATLVERIFY(::CloseClipboard());
return;
}
ATLVERIFY(::CloseClipboard());
}
示例2: ATLVERIFY
STDMETHODIMP
CNdasUnitImpl::GetRaidSimpleStatus (
NDAS_LOGICALUNIT_DEFINITION *NdasLogicalUnitDefinition,
UINT8 *NdasUnitNo,
DWORD *RaidSimpleStatusFlags
)
{
HRESULT hr;
HNDAS ndasHandle;
ATLVERIFY( RaidSimpleStatusFlags != NULL );
hr = ConnectUnitDevice(&ndasHandle);
if (FAILED(hr)) {
return hr;
}
hr = NdasVsmGetRaidSimpleStatus( ndasHandle, NdasLogicalUnitDefinition, NdasUnitNo, RaidSimpleStatusFlags );
if (FAILED(hr)) {
ATLVERIFY(S_OK == DisonnectUnitDevice(ndasHandle));
return hr;
}
ATLVERIFY(S_OK == DisonnectUnitDevice(ndasHandle));
return S_OK;
}
示例3: ATLASSERT
DWORD
CNdasDevicePropGeneralPage::pUpdateThreadStart(DWORD UnitIndex)
{
ATLASSERT(UnitIndex < RTL_NUMBER_OF(m_pUnitDevices));
if (UnitIndex >= RTL_NUMBER_OF(m_pUnitDevices))
{
ATLVERIFY(PostMessage(
WM_THREADED_WORK_COMPLETED, 0, static_cast<LPARAM>(UnitIndex)));
return 255;
}
ndas::UnitDevicePtr pUnitDevice = m_pUnitDevices[UnitIndex];
if (!pUnitDevice)
{
ATLVERIFY(PostMessage(
WM_THREADED_WORK_COMPLETED, 0, static_cast<LPARAM>(UnitIndex)));
return 1;
}
(void) pUnitDevice->UpdateHostStats();
ATLVERIFY(PostMessage(
WM_THREADED_WORK_COMPLETED, 0, static_cast<LPARAM>(UnitIndex)));
return 0;
}
示例4: helper
HRESULT CCurrencyConversionSamplePlugin::StartDisplayingItems() {
CComQIPtr<IGoogleDesktopDisplayPluginHelper> helper(m_pluginHelper);
if (m_pluginHelper == NULL)
return E_FAIL;
// set flags
GoogleDesktopDisplayPluginFlags plugin_flags = GDD_PLUGIN_FLAG_NONE;
GoogleDesktopDisplayContentFlags content_flags = GDD_CONTENT_FLAG_NONE;
ATLVERIFY(SUCCEEDED(helper->SetFlags(plugin_flags, content_flags)));
// set about text
CComBSTR about_text;
about_text.LoadString(IDS_COPYRIGHT);
ATLVERIFY(SUCCEEDED(helper->put_about_text(about_text)));
// set icons
CComPtr<IPicture> title_icon, about_icon;
ATLVERIFY(SUCCEEDED(::LoadPictureFromResource(ghInstance,
MAKEINTRESOURCE(IDR_GIF_CURRENCY_ICON_SMALL), L"GIF",
&title_icon)));
ATLVERIFY(SUCCEEDED(::LoadPictureFromResource(ghInstance,
MAKEINTRESOURCE(IDR_GIF_CURRENCY_ICON_LARGE), L"GIF",
&about_icon)));
ATLVERIFY(SUCCEEDED(helper->SetIcons(title_icon, about_icon)));
UpdateTitle(false);
// display the first set of items
SetContentLayout();
ChangeItems(NULL);
return S_OK;
}
示例5: ATLASSERT
CNBNdasDevice::CNBNdasDevice(PNDASUSER_DEVICE_ENUM_ENTRY pBaseInfo, NDAS_DEVICE_STATUS status)
{
ATLASSERT(pBaseInfo);
CopyMemory(&m_BaseInfo, pBaseInfo, sizeof(NDASUSER_DEVICE_ENUM_ENTRY));
m_status = status;
ATLVERIFY(SUCCEEDED( StringCchCopy(
m_NdasId.Id, RTL_NUMBER_OF(m_NdasId.Id), pBaseInfo->szDeviceStringId) ));
if (pBaseInfo->GrantedAccess & GENERIC_WRITE)
{
// We uses the magic write key in case write access is granted.
ATLVERIFY(SUCCEEDED( StringCchCopy(
m_NdasId.Key, RTL_NUMBER_OF(m_NdasId.Key), _T("*****")) ));
}
ZeroMemory(&m_DeviceId, sizeof(NDAS_DEVICE_ID));
NdasIdStringToDeviceEx(pBaseInfo->szDeviceStringId, &m_DeviceId, NULL, &m_IdExtData);
m_DeviceId.VID = m_IdExtData.VID;
#if 0
NDASUSER_DEVICE_INFORMATION ndasDeviceInfo;
ATLVERIFY( NdasQueryDeviceInformation(pBaseInfo->SlotNo, &ndasDeviceInfo) );
m_DeviceId = ndasDeviceInfo.HardwareInfo.NdasDeviceId;
#endif
if (m_DeviceId.VID == 0) {
ATLTRACE(_T("Assume VID is 1 if VID=0\n"));
m_DeviceId.VID = 1;
}
ATLTRACE(_T("new CNBNdasDevice(%p) : Name %s, ID %s, Slot %d, Access %08x\n"),
this, pBaseInfo->szDeviceName, pBaseInfo->szDeviceStringId, pBaseInfo->SlotNo, pBaseInfo->GrantedAccess);
}
示例6: ATLVERIFY
HRESULT CExeModule::LoadExchangeCodes()
{
ATLVERIFY(SUCCEEDED(_LoadExchangeCodes(STOCKEXCHANGECODES_SETTINGS, m_StockExchangeCodes)));
ATLVERIFY(SUCCEEDED(_LoadExchangeCodes(OPTIONEXCHANGECODES_SETTINGS, m_OptionExchangeCodes)));
return S_OK;
}
示例7: GetLastError
DWORD
CDismountDialog::WorkItemStart()
{
m_EjectError = 0;
BOOL success = m_pLogDevice->Eject(&m_EjectParam);
if (!success)
{
m_EjectError = GetLastError();
ATLTRACE("Eject failed, error=0x%X\n", m_EjectError);
}
else
{
if (m_EjectParam.ConfigRet != CR_SUCCESS)
{
ATLTRACE("Eject failed from configuration manager, configRet=%d\n",
m_EjectParam.ConfigRet);
ATLTRACE("VetoType=%d,VetoName=%ls\n",
m_EjectParam.VetoType,
m_EjectParam.VetoName);
}
}
ATLVERIFY( PostMessage(WM_WORKITEM_COMPLETED) );
ATLVERIFY( SetEvent(m_WorkItemFinished) );
return 0;
}
示例8: switch
BOOL
CPnpEventConsumerWindow::OnDeviceChange(
UINT EventType, PDEV_BROADCAST_HANDLE Dbch)
{
switch (EventType)
{
case DBT_DEVICEREMOVECOMPLETE:
{
ATLVERIFY( m_DevNotifyHandles.Remove(Dbch->dbch_hdevnotify) );
printf("Unregistering DevNotifyHandle=%p\n", Dbch->dbch_hdevnotify);
ATLVERIFY( UnregisterDeviceNotification(Dbch->dbch_hdevnotify) );
}
break;
case DBT_CUSTOMEVENT:
if (IsEqualGUID(Dbch->dbch_eventguid, GUID_NDASPORT_PNP_NOTIFICATION))
{
PNDASPORT_PNP_NOTIFICATION ndasportNotification =
reinterpret_cast<PNDASPORT_PNP_NOTIFICATION>(Dbch->dbch_data);
OnNdasPortEvent(ndasportNotification);
}
else if (IsEqualGUID(Dbch->dbch_eventguid, GUID_NDAS_ATA_LINK_EVENT))
{
PNDAS_ATA_LINK_EVENT ndasAtaLinkEvent =
reinterpret_cast<PNDAS_ATA_LINK_EVENT>(Dbch->dbch_data);
OnNdasAtaLinkEvent(ndasAtaLinkEvent);
}
else if (IsEqualGUID(Dbch->dbch_eventguid, NDAS_DLU_EVENT_GUID))
{
PNDAS_DLU_EVENT ndasDluEvent =
reinterpret_cast<PNDAS_DLU_EVENT>(Dbch->dbch_data);
OnNdasDluEvent(ndasDluEvent);
}
else if (IsEqualGUID(Dbch->dbch_eventguid, GUID_IO_VOLUME_MOUNT))
{
// printf("Volume is mounted, handle=%p\n", Dbch->dbch_handle);
}
else
{
OLECHAR guidString[64] = {0};
StringFromGUID2(
Dbch->dbch_eventguid,
guidString,
64);
if (-1 != Dbch->dbch_nameoffset)
{
printf("Unknown %s (%ls)",
((PUCHAR)Dbch) + Dbch->dbch_nameoffset,
guidString);
}
else
{
printf("Unknown %ls", guidString);
}
}
}
return TRUE;
}
示例9: SetRegistryDWORD
void SetRegistryDWORD(const HKEY root, const std::wstring& subkey, const std::wstring& valueName, const DWORD value)
{
HKEY key;
if (::RegOpenKeyExW(root, subkey.c_str(), 0, KEY_ALL_ACCESS, &key) != ERROR_SUCCESS)
return;
ATLVERIFY(ERROR_SUCCESS == ::RegSetValueExW(key, valueName.c_str(), 0, REG_DWORD, reinterpret_cast<const BYTE*>(&value), sizeof(value)));
ATLVERIFY(::RegCloseKey(key) == ERROR_SUCCESS);
}
示例10: ATLTRACE
void
CMainFrame::OnNdasServiceConnectFailed()
{
ATLTRACE("Connection to the NDAS Service failed.\n");
ATLVERIFY(m_taskbarIcon.ChangeIcon(_CreateTaskbarIcon(false)));
ATLVERIFY( m_taskbarIcon.SetToolTipText(IDR_TASKBAR_FAIL) );
}
示例11: PostMessage
LRESULT CMiniPieFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CAppInfo info;
// Full screen mode delayed restoration
bool bFull = false;
info.Restore(bFull, L"Full");
if (bFull)
PostMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
CreateSimpleCEMenuBar();
#ifdef WIN32_PLATFORM_WFSP // SmartPhone
AtlActivateBackKey(m_hWndCECommandBar);
#endif
UIAddToolBar(m_hWndCECommandBar);
SetCommandButton(ID_APP_EXIT);
// StatusBar state restoration
bool bVisible = true;
info.Restore(bVisible, L"Status");
DWORD dwStyle = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_TOP;
if (bVisible)
dwStyle |= WS_VISIBLE;
// StatusBar creation
CreateSimpleStatusBar(ATL_IDS_IDLEMESSAGE, dwStyle);
UIAddStatusBar(m_hWndStatusBar);
UISetCheck(ID_VIEW_STATUS_BAR, bVisible);
// Browser view creation
m_hWndClient = m_browser.Create(m_hWnd, NULL, _T("Microsoft.PIEDocView"),
WS_CHILD | WS_VISIBLE | WS_BORDER, 0, ID_BROWSER);
ATLVERIFY(SUCCEEDED(m_browser.QueryControl(&m_spIWebBrowser2)));
ATLVERIFY(SUCCEEDED(AtlAdviseSinkMap(this, true)));
// Navigation menu initialization
UIEnable(IDM_BACK, FALSE);
UIEnable(IDM_FORWARD, FALSE);
UIEnable(IDM_STOP, FALSE);
UIEnable(IDM_REFRESH, FALSE);
#ifdef WIN32_PLATFORM_PSPC
// PPC Address bar state restoration
VARIANT_BOOL vb = ATL_VARIANT_TRUE;
info.Restore(vb, L"Address");
m_spIWebBrowser2->put_AddressBar(vb);
UISetCheck(ID_VIEW_ADDRESSBAR, vb == ATL_VARIANT_TRUE);
#endif
// register object for message filtering and idle updates
CMessageLoop* pLoop = _Module.GetMessageLoop();
ATLASSERT(pLoop != NULL);
pLoop->AddMessageFilter(this);
pLoop->AddIdleHandler(this);
return 0;
}
示例12: RegisterWithGDEventFramework
HRESULT RegisterWithGDEventFramework() {
CComPtr<IGoogleDesktopRegistrar> registrar;
HRESULT hr = registrar.CoCreateInstance(L"GoogleDesktop.Registrar");
if (SUCCEEDED(hr)) {
CComBSTR our_guid(CONSOLE_PLUGIN_GUID);
WCHAR icon_path[_MAX_PATH + 1] = {0};
ATLVERIFY(::GetModuleFileNameW(NULL, icon_path, _MAX_PATH - 2) != 0);
SafeStrCat(icon_path, L"@0", _MAX_PATH+1);
CComSafeArray<VARIANT> description;
ATLVERIFY(SUCCEEDED(description.Create(8)));
VARIANT* props = reinterpret_cast<VARIANT*>(description.m_psa->pvData);
for (DWORD i = 0; i < description.GetCount(); ++i) {
props[i].vt = VT_BSTR;
}
props[0].bstrVal = ::SysAllocString(L"Title");
props[1].bstrVal = ::SysAllocString(L"Console Events");
props[2].bstrVal = ::SysAllocString(L"Description");
props[3].bstrVal = ::SysAllocString(L"Outputs events from Google Desktop to the console");
props[4].bstrVal = ::SysAllocString(L"Icon");
props[5].bstrVal = ::SysAllocString(icon_path);
props[6].bstrVal = ::SysAllocString(L"Homepage");
props[7].bstrVal = ::SysAllocString(L"http://desktop.google.com");
VARIANT desc;
desc.vt = VT_ARRAY | VT_VARIANT;
desc.parray = description;
hr = registrar->StartComponentRegistration(our_guid, desc);
if (SUCCEEDED(hr)) {
CComPtr<IUnknown> unknown;
hr = registrar->GetRegistrationInterface(CComBSTR(L"GoogleDesktop.EventRegistration"),
&unknown);
ATLASSERT(SUCCEEDED(hr));
CComQIPtr<IGoogleDesktopRegisterEventPlugin> event_registration(unknown);
if (event_registration != NULL) {
long cookie = 0;
hr = event_registration->RegisterPlugin(our_guid, &cookie);
if (SUCCEEDED(hr)) {
hr = registrar->FinishComponentRegistration();
if (SUCCEEDED(hr)) {
hr = StoreRegistrationCookie(cookie);
}
}
}
}
}
return hr;
}
示例13: ATLTRACE
void
CNdasDevicePropGeneralPage::OnReset()
{
ATLTRACE(__FUNCTION__ "\n");
ATLVERIFY(AtlWaitWithMessageLoop(m_ThreadCompleted));
ATLVERIFY(m_imageList.Destroy());
ATLVERIFY(DestroyAcceleratorTable(m_hAccel));
}
示例14: GetDlgItemInt
STDMETHODIMP SysMonPluginPropPage::Apply(void) {
int refresh_interval = GetDlgItemInt(IDC_EDIT_REFRESH_INTERVAL, NULL, 0);
int max_disk_rw = GetDlgItemInt(IDC_EDIT_MAX_DISK_RW, NULL, 0);
int max_net_io = GetDlgItemInt(IDC_EDIT_MAX_NET_IO, NULL, 0);
int active_monitors = 0;
int auto_adjust_chart_max = 1;
if (!refresh_interval) {
refresh_interval = 1; // Minimum 1 seconds
}
if (!max_disk_rw) {
max_disk_rw = 50000;
}
if (!max_net_io) {
max_net_io = 50000;
}
if (::SendMessage(GetDlgItem(IDC_CHECK_CPU),
BM_GETCHECK, 0, 0) == BST_CHECKED) {
active_monitors |= ACTIVE_MON_CPU;
}
if (::SendMessage(GetDlgItem(IDC_CHECK_MEM),
BM_GETCHECK, 0, 0) == BST_CHECKED) {
active_monitors |= ACTIVE_MON_MEM;
}
if (::SendMessage(GetDlgItem(IDC_CHECK_DISK),
BM_GETCHECK, 0, 0) == BST_CHECKED) {
active_monitors |= ACTIVE_MON_DISK;
}
if (::SendMessage(GetDlgItem(IDC_CHECK_NET),
BM_GETCHECK, 0, 0) == BST_CHECKED) {
active_monitors |= ACTIVE_MON_NET;
}
auto_adjust_chart_max = (::SendMessage(GetDlgItem(IDC_CHECK_AUTO_MAX),
BM_GETCHECK, 0, 0) == BST_CHECKED);
for (int i = 0; i < static_cast<int>(m_nObjects); ++i) {
CComQIPtr<IGoogleDesktopSysMonPlugin> plugin(m_ppUnk[i]);
if (plugin) {
ATLVERIFY(SUCCEEDED(plugin->put_refresh_interval(refresh_interval)));
ATLVERIFY(SUCCEEDED(plugin->put_active_monitors(active_monitors)));
ATLVERIFY(SUCCEEDED(plugin->put_max_disk_rw_in_chart(max_disk_rw)));
ATLVERIFY(SUCCEEDED(plugin->put_max_net_io_in_chart(max_net_io)));
ATLVERIFY(SUCCEEDED(plugin->put_auto_adjust_chart_max(
auto_adjust_chart_max)));
}
}
m_bDirty = FALSE;
return S_OK;
}
示例15: ATLVERIFY
void
CMainFrame::pChangeTaskBarIcon(bool Normal)
{
if (Normal) {
ATLVERIFY( m_taskbarIcon.ChangeIcon(pCreateTaskbarIcon(true)) );
ATLVERIFY( m_taskbarIcon.SetToolTipText(IDR_TASKBAR) );
} else {
ATLVERIFY( m_taskbarIcon.ChangeIcon(pCreateTaskbarIcon(false)) );
ATLVERIFY( m_taskbarIcon.SetToolTipText(IDR_TASKBAR_FAIL) );
}
}