Solved

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

Posted on 1997-08-13
2
358 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
add elements to existing standard structure 2 96
C++ Language error 28 197
Need some help with Microsoft Visual Studio C++ 2003 5 53
What is sub-make ? 2 40
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

863 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

26 Experts available now in Live!

Get 1:1 Help Now