Solved

ole type library problem

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Trouble with References... 5 67
VIDEO DATASOURCE Control Resize issue 2 62
Bitwise and to sum elements 2 52
MDT Create a bootable media for BIOS 2 23
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…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

734 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