Solved

ole type library problem

Posted on 1998-09-16
5
328 Views
Last Modified: 2013-11-25
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
Comment
Question by:dgunthor
  • 2
  • 2
5 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1172868
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
 
LVL 3

Expert Comment

by:Norbert
ID: 1172869
stupid question but
Did you register the release version
what happens when you execute your release version with the
commandline parameter /Embedding ?
0
 

Author Comment

by:dgunthor
ID: 1172870
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
 
LVL 3

Accepted Solution

by:
Norbert earned 20 total points
ID: 1172871
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
 

Author Comment

by:dgunthor
ID: 1172872
yep, spot on. when i run the application in release mode then call it using vb it works fine.

thanks,

dave
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question