Solved

Getting the App pointer

Posted on 1998-12-27
3
180 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
3 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
Comment Utility
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
Comment Utility
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 100 total points
Comment Utility
If you need this info, 'GetModuleFileName()' will do the job for you whan you supply 'NULL' as the first parameter...
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.

762 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