Ik ben bezig aan een kleine class die het MSN Popup venstertje (idd, dat ranzig blauw ding) nabootst (in C++ met de plain Win32 api)
Nu heb ik een class genaamd CPopupWindow, met daarin een aantal intialisatiefuncties en een Windowproc.
Omdat die windowproc een CALLBACK functie is, moest ik deze static declaren. In de windowproc heb ik echter ook een member variabele nodig, die opslaat welke bitmap als achtergrond te gebruiken. Dit is geen static variabele.
de class is dus dit:
Het probleem is nu echter, dat ik een compile error krijg dat m_hInstance en m_szNoteBackground niet toegankelijk zijn vanuit een static functie. Niks abnormaals. Maar als ik ze dan ook static maak, krijg ik een 'unresolved extrernal symbol' link error.
Dus mijn vraag: Hoe kan ik deze variabelen aanspreken vanuit een static functie? MSDN hielp niet echt veel...
Nu heb ik een class genaamd CPopupWindow, met daarin een aantal intialisatiefuncties en een Windowproc.
Omdat die windowproc een CALLBACK functie is, moest ik deze static declaren. In de windowproc heb ik echter ook een member variabele nodig, die opslaat welke bitmap als achtergrond te gebruiken. Dit is geen static variabele.
de class is dus dit:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| class CPopupNote
{
public:
CPopupNote( HINSTANCE hInstance, LPCTSTR szResID );
virtual ~CPopupNote();
static BOOL CreateNoteWndClass( HINSTANCE hInstance );
DWORD WINAPI ShowNote( LPCTSTR lpszMessage );
protected:
static LRESULT CALLBACK NoteWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
HWND CreateNoteWindow( LPVOID lpData );
protected:
HINSTANCE m_hInstance;
LPCTSTR m_szNoteBackground;
}; |
Het probleem is nu echter, dat ik een compile error krijg dat m_hInstance en m_szNoteBackground niet toegankelijk zijn vanuit een static functie. Niks abnormaals. Maar als ik ze dan ook static maak, krijg ik een 'unresolved extrernal symbol' link error.
Dus mijn vraag: Hoe kan ik deze variabelen aanspreken vanuit een static functie? MSDN hielp niet echt veel...