Solved

ole type library problem

Posted on 1998-09-16
5
323 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now