Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Detection of OCX File

Detection of OCX File

Scheduled Pinned Locked Moved C / C++ / MFC
helpcom
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Coremn
    wrote on last edited by
    #1

    Hi all, I have a problem. I have written a program that uses a commercial activeX component. I need to distribute this program on other machines and in order to do that I need to also distribute the commercial .ocx file and register it. This is no problem. What I want to do is for my program to send a popup error message if the ocx file is not installed/registered with windows. Currently it just crashes. X| thanks ---

    B 1 Reply Last reply
    0
    • C Coremn

      Hi all, I have a problem. I have written a program that uses a commercial activeX component. I need to distribute this program on other machines and in order to do that I need to also distribute the commercial .ocx file and register it. This is no problem. What I want to do is for my program to send a popup error message if the ocx file is not installed/registered with windows. Currently it just crashes. X| thanks ---

      B Offline
      B Offline
      bryce
      wrote on last edited by
      #2

      why not do a cocreateinstance and catch any errors/exceptions Bryce

      C 2 Replies Last reply
      0
      • B bryce

        why not do a cocreateinstance and catch any errors/exceptions Bryce

        C Offline
        C Offline
        Coremn
        wrote on last edited by
        #3

        It crashes at TRY { CModelessMain::Create(...) } CATCH_ALL { ... } END_CATCH_ALL Never tried CoCreateInstance - will give it a go ---

        A 1 Reply Last reply
        0
        • B bryce

          why not do a cocreateinstance and catch any errors/exceptions Bryce

          C Offline
          C Offline
          Coremn
          wrote on last edited by
          #4

          bryce wrote: why not do a cocreateinstance and catch any errors/exceptions Ok How do I do that???? ---

          A 1 Reply Last reply
          0
          • C Coremn

            bryce wrote: why not do a cocreateinstance and catch any errors/exceptions Ok How do I do that???? ---

            A Offline
            A Offline
            Aisha Ikram
            wrote on last edited by
            #5

            You can create an object of your control using COM techniques: HRESULT hr = CoCreateInstance( CLSID_YourControlID, NULL, CLSCTX_INPROC_SERVER, IID_IYourControlInterface, (void**)&pInterfaceName); if (FAILED(hr)) { MessageBox( NULL, ”Failed to create instance of “ “Your Control”, ”Error!”, MB_ICONERROR); } For that you need to know the basics of COM. MSDN is a good source of learning so read about the basics of COM. All the best!! ;) @!$h@

            1 Reply Last reply
            0
            • C Coremn

              It crashes at TRY { CModelessMain::Create(...) } CATCH_ALL { ... } END_CATCH_ALL Never tried CoCreateInstance - will give it a go ---

              A Offline
              A Offline
              Aisha Ikram
              wrote on last edited by
              #6

              Create() method returns a BOOL, If you have specified appropriate parameters, the method does not crash. So better check for your parameters. In case the control is not registered, Create returns a FALSE. In this case, give user the message that control is not registered or installed. @!$h@

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups