Hi, thanks for the reply.
No, I am initializing the window using a pretty standard pixel format and window frame class.
Do I need to use ChangeDisplaySettings ?
I will go and have a look at ChangeDisplaySettings(DEVMODE, CDS_FULLSCREEN). I am going to go to bed now though cos its 5:35 am and I hav’nt slept yet I am starting to slur my typing…I have just read the question that I posted, and I see that I have left out quite I few words that should be in there to make up compleat sentences…Its time for bed.
Here is the code I normaly use.
//---------------------------------------------------------------------------
// Win32 entry point
//---------------------------------------------------------------------------
int WINAPI WinMain (
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG Msg;
WNDCLASS WndClass;
// Register the frame class
WndClass.style = 0;
WndClass.lpfnWndProc = (WNDPROC) MainWndProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = hInstance;
WndClass.hIcon = LoadIcon (hInstance, szAppName);
WndClass.hCursor = LoadCursor (NULL, IDC_ARROW);
WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
WndClass.lpszMenuName = szAppName;
WndClass.lpszClassName = szAppName;
if (!RegisterClass (&WndClass))
return FALSE;
// Create the frame
ghWnd = CreateWindow (
szAppName,
“3D Tron”,
WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
CW_USEDEFAULT,
CW_USEDEFAULT,
WIDTH,
HEIGHT,
NULL,
NULL,
hInstance,
NULL
);
// Make sure the window was created
if (!ghWnd)
return FALSE;
// Show and update main window
ShowCursor (FALSE);
ShowWindow (ghWnd, SW_MAXIMIZE);
UpdateWindow (ghWnd);
// Set aplication priority
SetPriority (Priority);
// Initialize character font data
InitCFData (CFMap);
InitCFDisplayLists (&CFBase, CFMap);
// Execute main program loop
while (!AppExitFlag)
{
// Process all pending Win32 messages
if (Priority==3)
SetPriority(2);
while (PeekMessage(&Msg, NULL, 0,0, PM_NOREMOVE) == TRUE)
{
if (GetMessage(&Msg, NULL, 0, 0))
{
TranslateMessage (&Msg);
DispatchMessage (&Msg);
}
else
{
return TRUE;
}
}
if (Priority==3)
SetPriority(3);
// Process main loop procedure
MainLoopBody();
}
return TRUE;
}
//---------------------------------------------------------------------------
// Main window procedure
//---------------------------------------------------------------------------
LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LONG lRet = 1;
PAINTSTRUCT ps;
RECT Rect;
switch (uMsg){
// On create window
case WM_CREATE:
ghDC = GetDC (hWnd);
if (!InitPixelFormat(ghDC))
PostQuitMessage (0);
// Initialize OpenGL
ghRC = wglCreateContext (ghDC);
wglMakeCurrent (ghDC, ghRC);
GetClientRect (hWnd, &Rect);
InitOpenGL ((GLsizei) Rect.right, (GLsizei) Rect.bottom);
// Initialize application
InitApplication();
break;
// On activate
case WM_ACTIVATE:
{
if (LOWORD(wParam)==WA_INACTIVE)
{
wglMakeCurrent (ghDC, NULL);
ShowWindow (hWnd, SW_MINIMIZE);
OldPriority = Priority;
Priority = 0;
SetPriority (Priority);
}
else
{
wglMakeCurrent(ghDC, ghRC);
ShowWindow(hWnd, SW_MAXIMIZE);
Priority = OldPriority;
SetPriority (Priority);
}
} break;
// On window repaint
case WM_PAINT:
BeginPaint (hWnd, &ps);
EndPaint (hWnd, &ps);
break;
// On window resize
case WM_SIZE:
GetClientRect (hWnd, &Rect);
ResizeViewport ((GLsizei) Rect.right, (GLsizei) Rect.bottom);
break;
// On window close
case WM_CLOSE:
if (ghRC)
wglDeleteContext (ghRC);
if (ghDC)
ReleaseDC (hWnd, ghDC);
ghRC = 0;
ghDC = 0;
DestroyWindow (hWnd);
break;
// On window destroy
case WM_DESTROY:
if (ghRC)
wglDeleteContext (ghRC);
if (ghDC)
ReleaseDC (hWnd, ghDC);
PostQuitMessage (0);
break;
Bla…
.
Bla…
.
Bla…
.
e.t.c.
.
.
thanks
Rohin