p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional C++, 3rd Edition (http://p2p.wrox.com/forumdisplay.php?f=790)
-   -   hOW TO ACCESS A CLASS EXTERNAL TO A dIALOG FRON INSIDE THE dIALOG (http://p2p.wrox.com/showthread.php?t=98506)

BillLea January 28th, 2016 07:58 PM

hOW TO ACCESS A CLASS EXTERNAL TO A dIALOG FRON INSIDE THE dIALOG
 
I raiase this question here as it pertains to code from the book. If this is the wrong forum please direct me to a more apporiate one.

I am tryinbg to rewrite an existing program into a thread based form. In this process I wanted to look at communicating with threads. I found the Logger class interesting and decided to convert it for use with a GUI based program.
I used Visual Studio 2015 community to greate a C++ MFC Dialoge based skeliton program. I added 3 button a and tyhree edit controls to the Dialog.
I copied the Logger.h and Logger.ccp files into the project and added the header files to the main ccp file. I instanciated the class outside the Dialog DoModal function and it works fine.

My problem is that I cannot figure out how to reach the logger.log("Message") function from the dialog with out the resort to a global variable. Since globals are said tobe a source of bugs could you poing out the method I need to access the member function of the class instanciated outside the Dialopg box?


Thanks
Nill Lea


All times are GMT -4. The time now is 07:31 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.