Feb 25, 2013 at 1:25am
Did you initialize m_hInstance in the cpp file?
HINSTANCE MainWindow::m_hInstance = NULL;
Feb 25, 2013 at 1:56am
Yes. Making m_hInstance non static seemed to solve the problem but i dont really understand why...
Feb 25, 2013 at 4:32am
Use this:
MainWindow::m_hInstance = hInstance; // THIS IS WHERE ERROR IS//
Static members does not have hidden 'this' pointer applied automatically.
Feb 25, 2013 at 5:03am
Thats what i thought modoran. Tried it, didnt work, and i need that particular HINSTANCE to be static now so i cant make it nonstatic
Feb 25, 2013 at 12:07pm
You have to initialize the static variable outside the class definition. Did you add that line of code to the top of the cpp file? e.g.
1 2 3 4 5 6 7 8 9
|
#include "MainWindow.h"
HINSTANCE MainWindow::m_hInstance = NULL;
MainWindow::MainWindow(HINSTANCE hInstance)
{
m_hInstance = hInstance; // should work
...
}
|
Last edited on Feb 25, 2013 at 12:14pm