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 826709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:27:28+00:00 2026-05-15T03:27:28+00:00

I have written a COM object that in turn uses a thrid party ActiveX

  • 0

I have written a COM object that in turn uses a thrid party ActiveX control. In my FinalConstruct() for my COM object, I instantiate the ActiveX control with the follow code:

  HRESULT hRes;
  LPCLASSFACTORY2 pClassFactory;
  hRes = CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
  bool bTest = SUCCEEDED(hRes);
  if (!bTest)
   return E_FAIL;
  if (SUCCEEDED(CoGetClassObject(__uuidof(SerialPortSniffer), CLSCTX_INPROC_SERVER, NULL,
   IID_IClassFactory2, (LPVOID *)(&pClassFactory))))
  {  ... more set up code

When I step over the line if (SUCCEEDED(CoGetClassObject(__uuidof(SerialPortSniffer), …,
I get 20+ lines in the Output window stating:

First-chance exception at 0x0523f82e
in SillyComDriver.exe: 0xC0000005:
Access violation writing location
0x00000000.

I also get the lines:

First-chance exception at 0x051e3f3d
in SillyComDriver.exe: 0xC0000096:
Privileged instruction. First-chance
exception at 0x100ab9e6 in
SillyComDriver.exe: 0xC000001D:
Illegal Instruction.

Notice these are first-chance exceptions. The program runs as expected I can access the third party methods/properties. Still, I’m left wondering why they are occurring. Perhaps my way of instantiating the ActiveX control (for which I want use of it’s methods/properties and not it’s GUI stuff) is incorrect? Besides the code I’m showing, I also put the line

#import "spsax.dll" no_namespace 

in the stdafx.h
That’s all the code necessary for my simple demo project. I noticed this problem because I had (inadvertently) set the “break on exceptions” options in my “real” project and it was breaking on this line. Once I removed it, it also works.

If you’re read this far thank you, and perhaps I can ask one other minor question. In my demo project, if I right click on SerialPortSniffer and “go to definition”, it takes me to the file C:….\AppData\Local\Temp\spsax.tlh. Can someone explain that? Finally, in my “real” project, right clicking on SerialPortSniffer and going to difinition leads to “The symbol ‘SerialPortSniffer’ is not defined”. It doesn’t seem to affect the program though. Is there some setting I’ve messed up?

By the way, all my code is written w/ VS2008.

Thanks,
Dave

  • 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-05-15T03:27:29+00:00Added an answer on May 15, 2026 at 3:27 am

    It’s usually nothing to worry about.

    When an exception is thrown, the debugger is notified and depending on the debugger configuration, it may stop the application or let the application resume normally. This is a "first-chance" exception. If the application resumes, then it may catch the exception, and do whatever is necessary in the exceptional case.

    If the application does not handle the exception, it becomes a "second-chance" exception and the debugger is notified again. The debugger is usually configured to stop the application at this point to let you see what went wrong.

    So if you get a first-chance exception and not receive a second-chance exception later, it’s usually means that nothing is wrong, and the application is handling exceptions in a "graceful" matter.

    (Also see Link)

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

Sidebar

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.