[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 1997-08-13
2
Medium Priority
?
383 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
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…
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 how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

649 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