Skip to main content
gamedev.net
🔒 Locked

Microsoft Direct3D Sample Problem

Started by sdoherty55 0 replies 150+ views
Original Post
sdoherty55
sdoherty55
I have noticed a problem with menu in many on the Microsoft Direct3D samples. For example, the Skinned Mesh sample does not seem to redisplay the menu if you go from windowed mode to full screen mode and then back to windowed mode by pressing alt-enter. Has anyone else noticed this? It also seems to be happening in my applications because I am using the framework? PS: I am running XP Professional. Thanks
sdoherty55
sdoherty55
Ok, I think I have debugged Microsoft samples and the DirectX frame work. I could be wrong, but if I am correct I expect Bill Gates to send me a check for, to be fair I will only charge him for an hours work at his billable rate. I won''t hold my breath for the check:

Here is What I think the problem is (code from "D3DAPP.CPP"):

-------------------------------------------------------------
HRESULT CD3DApplication::AdjustWindowForChange()
{
if( m_bWindowed )
{
// Set windowed-mode style
SetWindowLong( m_hWnd, GWL_STYLE, m_dwWindowStyle );
if( m_hMenu != NULL ){
SetMenu( m_hWnd, m_hMenu ){

}
else
{
// Set fullscreen-mode style
SetWindowLong( m_hWnd, GWL_STYLE, WS_POPUP|WS_SYSMENU|WS_VISIBLE );
m_hMenu = (HMENU)SetMenu( m_hWnd, NULL );
}
return S_OK;
}
-------------------------------------------------------------


Notice that the second call to SetMenu asigns the return code (a BOOLEAN) to m_hMenu. I can''t find anywhere in the documents that say the SetMEnu returns a menu handle. However, if you make the following change it appears to fix the problem (at least in my app):

old code -----------------------------------
m_hMenu = (HMENU)SetMenu( m_hWnd, NULL );
old code -----------------------------------

new code -----------------------------------
m_hMenu = GetMenu(m_hWnd);
SetMenu( m_hWnd, NULL );
new code -----------------------------------

Can someone confirm that this fixes the problem? I am willing to share Bill check with you.

Thanks

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.