Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ole type library problem

Posted on 1998-09-16
5
Medium Priority
?
335 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 80 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

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.

Question has a verified solution.

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

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

636 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