• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • Last Modified:

ole type library problem

hi,

i have enabled ole automation support in my mfc dialog application (vc6.0). when i build the debug version it creates a .tlb type library file but when i build the release version it doesn't. so whenever i launch my application using ole it launches the debug version.

how can i build the release version properly?

thanks,

dave
0
dgunthor
Asked:
dgunthor
  • 2
  • 2
1 Solution
 
nietodCommented:
Did you enable ole automatation in both the release and debug versions?   I don't have 6.0 yet (should arrive tomorrow), but in 5.0 when you set the configuration, there is a drop down list called "settings for" at the top of the dialog that indicates what configuration (release or debug) that you are altering.
0
 
NorbertCommented:
stupid question but
Did you register the release version
what happens when you execute your release version with the
commandline parameter /Embedding ?
0
 
dgunthorAuthor Commented:
hi nietod,

ole is enabled in both versions. i am using vb to launch the app using an ole call. this launches the debug exe of my application *always*. i guess it is something to do with the ole type library.

hi norbert,

i'm not sure what you mean by 'did i register the release version'. i only have one registry file (.reg) and it is not debug or release specific.

if i launch the application with /Embedding on the command line it runs fine. i'm not sure what this does though.

regards,

dave


0
 
NorbertCommented:
I Think it has nothing to do with the type library
Some Basics:
There is a Registry on each mswindow system
Within this registry there are entries for your application.
One of these entries holds the path of your executable.
Your debug version normaly is stored in the path
<SomeDrive:>\YourAppPath\Debug\YourApp.Exe
Your release version normaly is stroed in the path
<SomeDrive:>\YourAppPath\Release\YourApp.Exe
to start your App by Ole/Com the OLE librarys search for the
program by using the registry entry (this is a simple summary for that what realy happens) adds a \Embedding as commandline parameter and starts your app.
Thats the reason because I was asking you the two questions above.
To register:
normaly the Appwizzard provides inside the InitInstance function the code to update the registry.
The code VC5.00 generates lookes like
      CCommandLineInfo cmdInfo;
      ParseCommandLine(cmdInfo);

      // Check to see if launched as OLE server
      if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
      {
            // Register all OLE server (factories) as running.  This enables the
            //  OLE libraries to create objects from other applications.
            COleTemplateServer::RegisterAll();
            // Application was run with /Embedding or /Automation.  Don't show the
            //  main window in this case.
            return TRUE;
      }

      // When a server application is launched stand-alone, it is a good idea
      //  to update the system registry in case it has been damaged.
      m_server.UpdateRegistry(OAT_DISPATCH_OBJECT);
      COleObjectFactory::UpdateRegistryAll();

      AfxMessageBox(IDP_USE_INSERT_OBJECT);
      return FALSE;
So to register the right executable it is enough to start it.
The Functions
      // When a server application is launched stand-alone, it is a good idea
      //  to update the system registry in case it has been damaged.
      m_server.UpdateRegistry(OAT_DISPATCH_OBJECT);
      COleObjectFactory::UpdateRegistryAll();
does set the correct path into the registry
so switching from debug to release version and viceversa should always start with a simple run and exit of the version of the app you want to use

0
 
dgunthorAuthor Commented:
yep, spot on. when i run the application in release mode then call it using vb it works fine.

thanks,

dave
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now