Re: How to use wxGetApp() ?

440 views
Skip to first unread message

Sirius

unread,
Jun 19, 2004, 3:39:53 PM6/19/04
to wx-u...@lists.wxwidgets.org
Problem solved after 1 hour+ of testing .... :-)
Sorry.

Sirius wrote:

> I need some info from my App, so I would like to use wxGetApp() to get
> my App but it is fail :-(
>
> If I #include "myApp.h" in "myFrame.h":
> myApp.h(3) : error C2011: 'CSxApp' : 'class' type redefinition
>
> If I didn't #include "myApp.h" in "myFrame.h":
> myFrame.cpp(99) : error C2065: 'wxGetApp' : undeclared identifier
>
>
>
> Here is my code:
> ------------------------
> //myApp.h
> #include "wx/wx.h"
>
> class CSxApp: public wxApp
> {
> virtual bool OnInit();
> ........... (other..)
> };
>
> DECLARE_APP(CSxApp)
>
> --------------------------
> //myFrame.h
>
> ...
> #include "myApp.h"
> ....
>
> --------------------------
> //myFrame.cpp
>
> wxMessageBox(wxGetApp().GetAppName());
>
> ---------------------------
>
>
>
>
> Thanks,
> Sirius
>
> WX: 2.5.1
> OS: WinXP Pro
> COMPILER: VC++ 6.0
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-u...@lists.wxwidgets.org
> For additional commands, e-mail: wx-use...@lists.wxwidgets.org
>
>
>


--
Thanks,
Sirius

WX: 2.5.1
OS: WinXP Pro
COMPILER: VC++ 6.0

Urs Weder

unread,
Jun 19, 2004, 3:24:41 PM6/19/04
to wx-u...@lists.wxwidgets.org

Sirius wrote:
> Hello,
>

> Here is my code:
> ------------------------
> //myApp.h

#ifndef MYAPP_H_INCLUDED
#define MYAPP_H_INCLUDED


> #include "wx/wx.h"
>
> class CSxApp: public wxApp
> {
> virtual bool OnInit();
> ........... (other..)
> };
>
> DECLARE_APP(CSxApp)

#endif
>
> --------------------------
> //myFrame.h
here the same to avoid multiple inclusion


>
> ...
> #include "myApp.h"
> ....
>
> --------------------------
> //myFrame.cpp
>
> wxMessageBox(wxGetApp().GetAppName());
>
> ---------------------------
>
>
>
>
> Thanks,
> Sirius
>
> WX: 2.5.1
> OS: WinXP Pro
> COMPILER: VC++ 6.0
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-u...@lists.wxwidgets.org
> For additional commands, e-mail: wx-use...@lists.wxwidgets.org
>


--
+-------------------------
| Urs Weder
| N 47°23'23" E 9°39'47"
+-------------------------
( modify address for return email )

Reply all
Reply to author
Forward
0 new messages