🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Interesting DX fullscreen mode problem...

Started by
1 comment, last by null_pointer 24 years, 5 months ago
I have had a lot of trouble with this one! I use a window class (a C++ class) that I built myself. Here's a declaration of the class: // Window.h: interface for the Window class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_Window_H__77FCF0A0_C131_11D3_A1DD_0050BAB009EE__INCLUDED_) #define AFX_Window_H__77FCF0A0_C131_11D3_A1DD_0050BAB009EE__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class Window { public: enum ZOrder { Top, TopMost, Normal, Bottom, }; typedef struct Size { int nWidth; int nHeight; }; typedef struct Position { int nX; int nY; }; public: Window(); virtual ~Window(); // Expose the object. HWND GetHandle(); // Create and destroy the window. virtual void Create(LPCSTR, DWORD, DWORD, int, int, int, int, int); virtual void Destroy(); // Set the size, position, and z-order. void SetSize(int, int); void SetPosition(int, int); void SetZOrder(ZOrder); // Get the size, position, and z-order. Size GetSize(); Position GetPosition(); ZOrder GetZOrder(); // Set the show state of the window. void Show(); void Hide(); void Restore(); void Minimize(); void Maximize(); // Directly modify style attributes (advanced). void SetStyle(LONG); // Set and destroy a WM_TIMER. UINT SetTimer(UINT, UINT); void KillTimer(UINT); // Retrieves windows with a specific relationship. Window* GetOwner(); Window* GetChild(UINT); // Retrieves the child ID of the window. UINT GetID(); // The Windows window callback procedure. static LRESULT Procedure(HWND, UINT, WPARAM, LPARAM); protected: // Handle window messages. virtual LRESULT OnMessage(); inline LRESULT Default(); protected: HWND m_hWnd; UINT m_nMsg; WPARAM m_wParam; LPARAM m_lParam; }; LRESULT Window:: Procedure(HWND, UINT, WPARAM, LPARAM); #endif // !defined(AFX_Window_H__77FCF0A0_C131_11D3_A1DD_0050BAB009EE__INCLUDED_) The Window:: Procedure is a static function that is assigned in a generic WNDCLASS structure. It implements all message-handling for the class via virtual Window:: OnMessage(), but I won't spoil the fun by telling you how it's done! (Gurus, don't spoil it for the newbies!) The Problem: Whenever I use DX in fullscreen mode, the program crashes Windows (I mean the keyboard and everything locks up!!), but windowed mode works fine. TIP: DX is initialized properly. Can anybody figure out what's wrong with this? P.S. Anybody who can figure it out gets the source code for the class! (as if anyone really wanted it anyway...) I already have the problem solved but wanted to see if anyone else could figure it out. - null_pointer Edited by - null_pointer on 1/13/00 9:41:31 AM
Advertisement
Try declaring your window procedure as:

LRESULT CALLBACK Procedure(HWND, UINT, WPARAM, LPARAM);

DDraw hooks your window procedure, and assumes CALLBACK.
ARRGHHH! Someone guessed it!!

This problem doesn''t show up in the compiler if you cast Window:: Procedure to a (WNDPROC) as directed in the docs. That''s why it took me so long to figure it out in the first place.

Oh, mhkrause, if you want the source mailed to you just let me know...if I don''t hear from you for a day or so I''ll just send it with the subject line "Window source code," okay?


- null_pointer

This topic is closed to new replies.

Advertisement