Its still not working, but im making progress.
I dont think the instance is right. Let me post my code up to the part that this is not working.
Code:
bool cWindowManager::CreateWin(int p_w, int p_h, int p_b) {
//=============================================================================
// Signal function callbacks, sends these signals to the sigproc function
//=============================================================================
signal(SIGSEGV, SignalProc);
signal(SIGTERM, SignalProc);
signal(SIGILL, SignalProc);
//=============================================================================
// Default init window variables
//=============================================================================
hdc=NULL;
hwn=NULL;
hrc=NULL;
//=============================================================================
// assign the width and height to variables
//=============================================================================
width = p_w;
height = p_h;
bits = p_b;
//=============================================================================
// Set the windows desired size
//=============================================================================
rect.left = 0;
rect.right = width;
rect.top = 0;
rect.bottom = height;
//=============================================================================
// Grab an instance for the window
//=============================================================================
if(!(hin = GetModuleHandle(NULL))) {
error[0] = true;
exerror[0] = GetLastError();
}
//=============================================================================
// Setup the window style
//=============================================================================
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = NULL;
wc.hCursor = NULL;
wc.hIcon = NULL;
wc.hInstance = hin;
wc.lpfnWndProc = (WNDPROC) WindowProc;
wc.lpszClassName = "EndAgeOpenGLWindow";
wc.lpszMenuName = NULL;
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
//=============================================================================
// Register the window class
//=============================================================================
if(!RegisterClass(&wc)) error[1] = true;
//=============================================================================
// Setup device mode
//=============================================================================
ss.dmSize = sizeof(ss);
ss.dmPelsHeight = height;
ss.dmPelsWidth = width;
ss.dmBitsPerPel = bits;
ss.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
//=============================================================================
// go into fullscreen mode
//=============================================================================
int errorcode = ChangeDisplaySettings(&ss,CDS_FULLSCREEN);
switch(errorcode) {
case DISP_CHANGE_RESTART:
error[2] = true;
break;
case DISP_CHANGE_BADFLAGS:
error[3] = true;
break;
case DISP_CHANGE_BADPARAM:
error[4] = true;
break;
case DISP_CHANGE_FAILED:
error[5] = true;
break;
case DISP_CHANGE_BADMODE:
error[6] = true;
break;
case DISP_CHANGE_NOTUPDATED:
error[7] = true;
break;
}
//=============================================================================
// setup window styles
//=============================================================================
s = WS_OVERLAPPEDWINDOW;
xs = WS_EX_APPWINDOW;
//=============================================================================
// Adjust the window rect
//=============================================================================
AdjustWindowRectEx(&rect,s,false,xs);
//=============================================================================
// Create the window
//=============================================================================
if(!(hwn = CreateWindowEx(xs,"EndAgeOpenGLWindow",WINDOW_NAME,s,0,0,rect.right-rect.left,rect.bottom-rect.top,NULL,NULL,hin,NULL))) {
error[8] = true;
exerror[8] = GetLastError();
}
Now, everytime I run the debugger hin starts with some junk value, after that segment it is set to 0x00400000. If I expand the hin variable one level in the watch window it says unused and has a bunch of numbers. Let me post a screenshot of the watch window.
http://img64.photobucket.com/albums/...n/codeprob.png
Its not returning NULL, so its not an error, I dont know what it is but I think it is the reason that CreateWindowEx dosent work.
The only other thing I can think of is that the WindowProc function is in anoter source file and this file has an extern to it, but I dont see how that could matter.
My system is a Laptop. Toshiba Satellite P25
2.8 Ghz P4 HT
800Mhz FSB
512 Mb DDR RAM
Geforce FX Go 32 Mb
The system has a 17' widescreen display and it runs at 1440 x 900 resolution. This code is just a copy and paste from an old program and that program works fine with the code and the resolution, but I figured it was worth mentioning.
I remain 'at a loss'...
I ran a DXDIAG, nothing was flagged.