Solved

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

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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.

746 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

11 Experts available now in Live!

Get 1:1 Help Now