Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Getting the App pointer

Posted on 1998-12-27
3
Medium Priority
?
188 Views
Last Modified: 2010-04-16
I am writting a dll.  How do I get a pointer to the CWinApp class of the main program?

I tried AfxGetApp, but that returned the info on the dll.
0
Comment
Question by:DanielJenkins
[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
3 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1181069
This doesn't necessarily always work because you don't know if the application that is using the DLL is using MFC or not. If you have source to both the EXE and the DLL, then you should provide a function in the DLL that allows the EXE to pass in the CWinApp pointer as a parameter.
0
 

Author Comment

by:DanielJenkins
ID: 1181070
I don't know what applications will be using this DLL, it could be a Visual Basic App or a Visual C++ App.

The items I need are the applications path and executable name.
0
 
LVL 86

Accepted Solution

by:
jkr earned 400 total points
ID: 1181071
If you need this info, 'GetModuleFileName()' will do the job for you whan you supply 'NULL' as the first parameter...
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
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

604 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