PDA

View Full Version : Windowed c++ direct3d vc6


okay
12-02-2004, 08:25
Ho questo problema:

Premendo il tasto F1 da windows normale vado in fullscreen ma se ripremo F1 mi ritorna la finestra senza bordi ne la barra con l'icona?????
Sembra che questa linea di codice non abbia effetto:

SetWindowLong( hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_VISIBLE | WS_MINIMIZEBOX );








Questa è la routine........chiaramente prima resetto i parametri
m_pD3DDevice->Reset( &d3dpp )
.....e poi

ToggleFullScreen();


HRESULT CGame::ToggleFullScreen()
{
HRESULT hr;

m_bReady = false;

if( m_Fscreen )
{
// Set windowed mode style

SetWindowLong( hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_VISIBLE | WS_MINIMIZEBOX );

d3dpp.Windowed = true;

m_Fscreen=false;
}
else
{
// Set fullscreen mode style
SetWindowLong( hWnd, GWL_STYLE, WS_POPUP | WS_SYSMENU | WS_VISIBLE );

d3dpp.Windowed = false;

m_Fscreen=true;
}

//LogInfo("<li>m_Fscreen dopo %d.", m_Fscreen);


// Setup the new presentation parameters
d3dpp.hDeviceWindow = hWnd;
if( m_Fscreen == true )
{
d3dpp.BackBufferWidth = m_rcWindowClient.right - m_rcWindowClient.left;
d3dpp.BackBufferHeight = m_rcWindowClient.bottom - m_rcWindowClient.top;
d3dpp.BackBufferFormat = m_d3dfmtFullscreen;

d3ddm.Format : d3ddm.Format;

}
else
{

d3dpp.BackBufferWidth = m_dwCreationWidth;
d3dpp.BackBufferHeight = m_dwCreationHeight;
d3dpp.BackBufferFormat = m_dmDesktop.Format;

}

if( FAILED( hr = Resize3DEnvironment() ) )
{
return hr;
}

// If in windowed mode, adjust the window size.
if( m_Fscreen )
{
SetWindowPos( hWnd, HWND_NOTOPMOST,
m_rcWindowBounds.left, m_rcWindowBounds.top,
m_rcWindowBounds.right - m_rcWindowBounds.left,
m_rcWindowBounds.bottom - m_rcWindowBounds.top,
SWP_SHOWWINDOW );

cionci
12-02-2004, 08:46
Prova ad aggiungere:

SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_WINDOWEDGE);

cionci
12-02-2004, 09:01
Dai un'occhiata a ChangeDisplaySettings ;)

okay
12-02-2004, 09:57
creo in tutti ie due i modi, ma non risolvo:

MODO 1:

WNDCLASS wc = { 0, WinProc, 0, 0, hInst,
LoadIcon( hInst, MAKEINTRESOURCE( IDI_ICON ) ),
LoadCursor( NULL, IDC_ARROW ),
(HBRUSH)GetStockObject( BLACK_BRUSH ),
NULL, strAppname
};

if (!RegisterClass(&wc))
return 0;


if (g_bFullscreen==true)
{


// Create a fullscreen window, one that doesn't have anything in it
hWnd = CreateWindow(//NULL,
strAppname,
strAppname,
WS_POPUP | WS_SYSMENU | WS_VISIBLE,
0, 0 ,
mWidth, mHeight,
NULL,
NULL,
hInst,
NULL);


m_dwWindowStyle0 = WS_POPUP | WS_SYSMENU | WS_VISIBLE;
// Set the window's initial width and height
RECT rc;
SetRect( &rc, 0, 0, mWidth, mHeight );
AdjustWindowRect( &rc, m_dwWindowStyle0, false );



// Save the window's properties incase we have to switch modes
m_dwWindowStyle0 = GetWindowLong( hWnd, GWL_STYLE );
GetWindowRect( hWnd, &m_rcWindowBounds0 );
GetClientRect( hWnd, &m_rcWindowClient0 );




}
else
{



m_dwWindowStyle0 = WS_OVERLAPPEDWINDOW | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME |
WS_MINIMIZEBOX | WS_VISIBLE;

// Set the window's initial width and height
RECT rc;
SetRect( &rc, 0, 0, m_dwCreationWidth0, m_dwCreationHeight0 );
AdjustWindowRect( &rc, m_dwWindowStyle0, false );

// Create a fullscreen window, one that doesn't have anything in it
hWnd = CreateWindow(//NULL,
strAppname,
strAppname,

m_dwWindowStyle0,
//0, 0 ,
CW_USEDEFAULT, CW_USEDEFAULT,
//mWidth, mHeight,
(rc.right - rc.left), (rc.bottom - rc.top),
NULL,
NULL,
hInst,
NULL);



// Save the window's properties incase we have to switch modes
m_dwWindowStyle0 = GetWindowLong( hWnd, GWL_STYLE );


GetWindowRect( hWnd, &m_rcWindowBounds0 );
GetClientRect( hWnd, &m_rcWindowClient0 );


--------------------------------------

MODO 2

Aggiungo EX

WNDCLASSEX wc;

// Setup and register the window class
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WinProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(NULL);
// wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE( IDI_ICON));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = strAppname;
// wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wc.hIconSm = LoadIcon(hInst, MAKEINTRESOURCE( IDI_ICON));

e abilito NULL dove al modo 1 vedi sisabiliato dal commento

ma nulla di nulla
mentre nel listato che ho funziona............

pocco giuda

cionci
12-02-2004, 11:30
Sui tutoriale NeHE usano ChangeDisplaySettings

okay
12-02-2004, 12:39
Si lo so............appunto riguarda opengl
mentre io non uso le opengl

cionci
12-02-2004, 13:16
ChangeDisplaySettings è delle GDI... Non di OpenGL...