Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AfxGetApp problem

Status
Not open for further replies.

Vovin

Programmer
Aug 24, 2003
63
0
0
GB
Hi,

an MFC question. Within my CMainFrame class I want to access my App class methods. I've tried the following code:

CPOSAnywhereClientNTApp *app = dynamic_cast<CPOSAnywhereClientNTApp*>:):AfxGetApp());

IPAddress commandLineIPAddress = app->getTargetIPAddress();

if (!commandLineIPAddress.isNull())
{
// do something
}

I should get back a value from getTargetIPAddress() but I'm not. Does the code above make sense? Is the <CPOSAnywhereClientNTApp> legal? Any help would be much appreciated. Thanks.

 
For MFC applications
You can easily change the appearance of the visual style by the popular Microsoft products like office and visual studio. Parsing an XML file describes the visual styles. It can be accomplished by proceeding in the following way.

class CMyVisualManagerOffice2007 : public CMFCVisualManagerOffice2007
{
DECLARE_DYNCREATE(CMyVisualManagerOffice2007)
public:
CMyVisualManagerOffice2007();
virtual ~CMyVisualManagerOffice2007();

virtual BOOL IsOwnerDrawCaption() { return m_bCaptionOn && CMFCVisualManagerOffice2007::IsOwnerDrawCaption(); }

bool m_bCaptionOn;
};


Regards,
nirvanacanada.com/web-design-vancouver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top