?
Solved

Get the CWinApp object of the EXE that loads a DLL?

Posted on 1997-08-13
2
Medium Priority
?
381 Views
Last Modified: 2006-11-17
I have an OLE automation object derived from CCmdTarget in a regular MFC DLL. From an EXE program I create the object with the use of CreateObject(). The DLL is loaded an the constructor is called. The problem is that from the constructor or from InitInstance() in the DLL I want to find out which instance of the program that has made the
CreateObject() call to get some additional information from the program. I cannot do this later, because the object is also created from a VBA macro in the EXE program and several program runs simultaneously. If I just can get a back-pointer to the callers CWinApp I would be happy.
/Joel
0
Comment
Question by:syjwg
[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 Comments
 
LVL 7

Accepted Solution

by:
faster earned 100 total points
ID: 1167252
I guess it is hard, CreateObject() create your object indirectly and it is OLE that is calling you directly, so from this call I am afraid that you won't get any information of the clinet.  I still don't understand why you have to do it at this stage (if at a later stage it shall be very easy, also, if VBA is also a possible client, how can you get the CWinApp pointer?  VBA is not using MFC and therefore does not have such a poniter at all.
0
 

Author Comment

by:syjwg
ID: 1167253
It is a VBA compatible language (SaxBasic) from Polar Engineering, but the main question still exists. If a program (without OLE) loads a DLL. Is it possible to get a pointer back to the EXE program when the DLL is loaded? (not calling a DLL function that sets the pointer later.) The DLL itself has a CWinApp and that's the app I always get when trying to locate the EXE. Is there a way to get around this? With the use of the module state information perhaps?

0

Featured Post

Independent Software Vendors: 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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 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.
Suggested Courses

777 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