Display Settings
Hi! i''m just to take my first class in direct-x programming now, and the first "homework" we got was to write an application that could change display modes (from fullscreen to windowed mode and back) and manage the ALT+TAB problem... but i can''t get it to work.
is there any kind soul here who could give me some advice?
I am assuming you have access to the DX SDK. The common files framework provided by the SDK has a complete application framework that manages screen resolution changes as well as alt-tabbing.
Study that code and then write your homework application. (Don''t just submit the app framework since I would guess that would be cheating on your homework. :o)
The files you should look at are d3dapp.cpp and d3dapp.h in C:\DXSDK\samples\Multimedia\Common\src and C:\DXSDK\samples\Multimedia\Common\include
For an example of how those two are used, look at something like the billboard example in C:\DXSDK\samples\Multimedia\Direct3D\Billboard
This is assuming you installed the sdk to C:\DXSDK which is the default installdir.
If you have to write your own app from the ground up to do this, it is no small task so don''t put it off till the day before your homework is due, lol.
Study that code and then write your homework application. (Don''t just submit the app framework since I would guess that would be cheating on your homework. :o)
The files you should look at are d3dapp.cpp and d3dapp.h in C:\DXSDK\samples\Multimedia\Common\src and C:\DXSDK\samples\Multimedia\Common\include
For an example of how those two are used, look at something like the billboard example in C:\DXSDK\samples\Multimedia\Direct3D\Billboard
This is assuming you installed the sdk to C:\DXSDK which is the default installdir.
If you have to write your own app from the ground up to do this, it is no small task so don''t put it off till the day before your homework is due, lol.
well i don''t WANT you to do the homework for me, it''s just that the ALT-TAB''ing in fullscreen mode won''t display my application window...
but hey, thanx for the hint
cheers mates
but hey, thanx for the hint
cheers mates
What do you mean with manage the ALT-TAB problem?
You mean when DirectDraw looses its surfaces so you have to restore them?
Mail me and I''ll gladly help you
"Visual Basic, Java and trashed cars offers the same performance...trashed cars only move if it''s really steep, but on the other hand would Visual Basic and Java crash."
You mean when DirectDraw looses its surfaces so you have to restore them?
Mail me and I''ll gladly help you
"Visual Basic, Java and trashed cars offers the same performance...trashed cars only move if it''s really steep, but on the other hand would Visual Basic and Java crash."
quote:Original post by andreas_sweden
What do you mean with manage the ALT-TAB problem?
You mean when DirectDraw looses its surfaces so you have to restore them?
[swedish]
problemet är att när jag alt-tabbar FRÅN mitt fönster till något annat och tabbar TILLBAKA till mitt fönster (i fullsckärmsläge då) så verkar det som om applikationen inte reagerar på D3DERR_DEVICELOST eller så... grejen är den att fönstret uppdateras inte längre...
[/swedish]
HRESULT ValidateDevice(){ HRESULT r = 0; //test the current state of the device r = g_pDevice->TestCooperativeLevel(); if(FAILED(r)) { //if the device is lost then return failure if(r == D3DERR_DEVICELOST ) return E_FAIL; //if the device is ready to be reset then attempt to do so if(r==D3DERR_DEVICENOTRESET) { g_pBackSurface->Release(); //reset the device r = g_pDevice->Reset( &g_SavedPresParams); if(FAILED(r)) { //if the device was not reset then exit SetError("Could not reset device"); return E_FAIL; } //Reaquire a pointer to the new back buffer r = g_pDevice->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &g_pBackSurface); if(FAILED(r)) { SetError("Unable to reaquire the back buffer"); PostQuitMessage(0); return E_FAIL; } g_pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 0.0f,0); RestoreGraphics(); } } return S_OK;}HRESULT RestoreGraphics(){ return S_OK;}
call this every loop.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement