Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9123661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:23:42+00:00 2026-06-17T06:23:42+00:00

When I use ATL in MFC Application(Don’t ask me why, just because I like),

  • 0

When I use ATL in MFC Application(Don’t ask me why, just because I like), sometimes I got the error code: E_FAIL. However, it’s almost useless for me to locate the specific reason.

I have googled so many times, but found nothing related. I thought there should be something like try{} catch{} in ATL.

Here’s some sample code:

CAxWindow  m_wndView;  // ActiveX host window class.
CComPtr<IWMPPlayer>  m_spWMPPlayer;  // Smart pointer to IWMPPlayer interface.

AtlAxWinInit();
CComPtr<IAxWinHostWindow>  spHost;
HRESULT  hr;
CRect rcClient;
GetClientRect(&rcClient);
m_wndView.Create(m_hWnd, rcClient, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
//when I switch to Static Link to ATL from Dynamic Link to ATL, I always get E_FAIL
hr = m_wndView.QueryHost(&spHost);

Anyone can help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:23:43+00:00Added an answer on June 17, 2026 at 6:23 am

    The error code is entirely function specific. Think of piece of code [on the other side] that does return E_FAIL; What additional detail one can get from it? Chances are high you have no detail at all.

    Sometimes you can obtain additional information using GetErrorInfo API which in your case – having your code snippet in mind – is unlikely.

    The best you can do is to step inside to reach as close as possible to the origin of the code in order to tell where it comes from.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Without : MFC ATL How can I use FormatMessage() to get the error text
I need to write some code for a MFC project, but I don't know
I want to use class member functions as callbacks, I don't use libsigc, because
I'm writing some code in MFC and I want to use auto pointers. I've
Without : MFC ATL Question: What are the steps involved, to use IGlobalInterfaceTable ,
Can anyone recommend a ready-to-use class/library compatible with C/C++/MFC/ATL that would parse iCal/vCal/Google calendar
I am trying to do a comparison of CString from ATL/MFC to a custom
We are wondering how to use HttpWebRequest and HttpWebResponse .net framework Class in ATL
We have a C++ library (No MFC, No ATL) that provides some core functionality
So, I am trying to use CArray like this : CArray<CPerson,CPerson&> allPersons; int i=0;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.