I am trying to shift my project to my other computer. I think I have the compiler set up properly. Initially, I thought it was DX causing the issue, but I narrowed it down to WinMain(..). Here is the code:
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HWND hWnd;
WNDCLASSEX wc;
ZeroMemory(&wc, sizeof(WNDCLASSEX));
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
// wc.hbrBackground = (HBRUSH)COLOR_WINDOW; // not needed any more
wc.lpszClassName = "WindowClass";
RegisterClassEx(&wc);
hWnd = CreateWindowEx(NULL,
"WindowClass",
"Our Direct3D Program",
WS_EX_TOPMOST | WS_POPUP, // fullscreen values
0, 0, // the starting x and y positions should be 0
int(SCREEN_WIDTH),int( SCREEN_HEIGHT), // set the window size
NULL,
NULL,
hInstance,
NULL);
//return 0;//exits without crashing
ShowWindow(hWnd, nCmdShow);
return 0;//it will crash here
// set up and initialize Direct3D
GameEngine.initD3D(hWnd,hInstance);
//init the environment here.
// enter the main loop:
UINT ExitMessage=GameEngine.MainLoop();
return ExitMessage;
}
Notice the 2 return lines arround ShowWindow(..)? That's how I came to the conclusion it had something to do with showing the window. I believe it's the creation that's actually causing the problem, but I don't know what could cause it to work on one machine and not another. Perhapse I don't have the correct SDK (VC) or I don't have my compiler set up correctly????