Click here to Skip to main content
15,909,530 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionUrgent help required!!! Pin
NeerajN9-Feb-06 4:47
NeerajN9-Feb-06 4:47 
QuestionListBox Pin
Mike Winter9-Feb-06 4:11
Mike Winter9-Feb-06 4:11 
AnswerRe: ListBox Pin
#realJSOP9-Feb-06 4:19
professional#realJSOP9-Feb-06 4:19 
GeneralRe: ListBox Pin
Mike Winter9-Feb-06 5:02
Mike Winter9-Feb-06 5:02 
GeneralRe: ListBox Pin
Maximilien9-Feb-06 5:59
Maximilien9-Feb-06 5:59 
GeneralRe: ListBox Pin
Michael Dunn9-Feb-06 7:06
sitebuilderMichael Dunn9-Feb-06 7:06 
QuestionRe: ListBox Pin
David Crow9-Feb-06 7:33
David Crow9-Feb-06 7:33 
QuestionCapturing screen shots problem... please help Pin
llp00na9-Feb-06 3:35
llp00na9-Feb-06 3:35 
Dear everyone,

I am trying to capture screen shots of my application at different intervals. The program works fine when interval is 0.3 second. whenever I increase the interval to more than 0.3 (eg 1 second). I get totally black screen shots.

Please Can someone explain whats going wrong ? Thank you

here is the main code of my program:

bool CWebPageAnalyserDlg::iterateAndCapture(void)
{
int status = 1;
double interval = 0.3, result = 0;
clock_t clo = clock();

for(int i =0; i< 2; i++){
clo = clo + (clock_t)(interval * CLK_TCK);
result = (double) clo;
while (clock() < clo){
if (status==1) {
captureScreen(1);
status = 2;
} else {
captureScreen(2);
status = 1;
}
}
}
return false;
}


IDirect3DDevice8* g_pd3dDevice = NULL;
IDirect3DSurface8* surface = NULL;
HWND hwnd;
FILE* capture=fopen("Capture.txt","w");
void CWebPageAnalyserDlg::captureScreen(int status)
{
HRESULT hr;
CClientDC dc(this);
CWnd* cwnd = dc.GetWindow();
hwnd = cwnd->GetSafeHwnd();

IDirect3D8* g_pD3D = Direct3DCreate8(D3D_SDK_VERSION);
D3DDISPLAYMODE mode;
hr = g_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &mode);
UINT ScreenWidth = mode.Width;
UINT ScreenHeight= mode.Height;

D3DPRESENT_PARAMETERS present;
ZeroMemory(&present, sizeof(present));
present.SwapEffect = D3DSWAPEFFECT_COPY;
present.Windowed = TRUE;
present.BackBufferFormat = mode.Format;

hr = g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present, &g_pd3dDevice);

g_pd3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
if(FAILED(hr)) fprintf(capture,"\nSomething went wrong");
hr = g_pd3dDevice->CreateImageSurface(ScreenWidth,ScreenHeight, D3DFMT_A8R8G8B8,&surface);
if(FAILED(hr)) fprintf(capture,"\nSomething went wrong");

char* fileNameOne = (char*)"FirstShot.bmp";
char* fileNameTwo = (char*)"SecondShot.bmp";
g_pd3dDevice->GetFrontBuffer(surface);
if(status == 1)D3DXSaveSurfaceToFile(fileNameOne, D3DXIFF_BMP, surface, NULL, NULL);
if(status == 2)D3DXSaveSurfaceToFile(fileNameTwo, D3DXIFF_BMP, surface, NULL, NULL);
surface->Release();
}


llp00na
QuestionApplication not get execute in WINDOWS XP Pin
maharaja pandian9-Feb-06 1:49
maharaja pandian9-Feb-06 1:49 
AnswerRe: Application not get execute in WINDOWS XP Pin
sunit59-Feb-06 1:53
sunit59-Feb-06 1:53 
GeneralRe: Application not get execute in WINDOWS XP Pin
toxcct9-Feb-06 2:01
toxcct9-Feb-06 2:01 
GeneralRe: Application not get execute in WINDOWS XP Pin
maharaja pandian9-Feb-06 2:07
maharaja pandian9-Feb-06 2:07 
GeneralRe: Application not get execute in WINDOWS XP Pin
Cedric Moonen9-Feb-06 2:37
Cedric Moonen9-Feb-06 2:37 
GeneralRe: Application not get execute in WINDOWS XP Pin
maharaja pandian9-Feb-06 2:07
maharaja pandian9-Feb-06 2:07 
GeneralRe: Application not get execute in WINDOWS XP Pin
ThatsAlok10-Feb-06 0:34
ThatsAlok10-Feb-06 0:34 
QuestionDoModal returns error 1812 Pin
EthannCastell9-Feb-06 1:29
EthannCastell9-Feb-06 1:29 
Answer[Message Deleted] Pin
_AnsHUMAN_ 9-Feb-06 1:51
_AnsHUMAN_ 9-Feb-06 1:51 
AnswerRe: DoModal returns error 1812 Pin
James R. Twine9-Feb-06 1:57
James R. Twine9-Feb-06 1:57 
AnswerRe: DoModal returns error 1812 Pin
David Crow9-Feb-06 7:45
David Crow9-Feb-06 7:45 
QuestionThe \ problem.. :( Pin
Eytukan9-Feb-06 0:44
Eytukan9-Feb-06 0:44 
AnswerRe: The \ problem.. :( Pin
toxcct9-Feb-06 0:50
toxcct9-Feb-06 0:50 
GeneralRe: The \ problem.. :( Pin
Eytukan9-Feb-06 1:42
Eytukan9-Feb-06 1:42 
QuestionCreating another view for SDI project Pin
beko9-Feb-06 0:35
beko9-Feb-06 0:35 
AnswerRe: Creating another view for SDI project Pin
#realJSOP9-Feb-06 4:20
professional#realJSOP9-Feb-06 4:20 
GeneralRe: Creating another view for SDI project Pin
Rage9-Feb-06 7:26
professionalRage9-Feb-06 7:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.