Solved

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

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FMX enumerated colours 2 101
C++ to C# code conversion issue 4 108
How to convert MFC::CString to UTF8 wchar_t* 10 214
How to Correctly derive class from CWinThread in MFC 4 42
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 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.

821 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