Click here to Skip to main content
15,921,276 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: using SHBrowseForFolder Pin
PJ Arends21-Oct-04 20:08
professionalPJ Arends21-Oct-04 20:08 
QuestionMFC and the MAIN method??? Pin
Anonymous21-Oct-04 19:38
Anonymous21-Oct-04 19:38 
AnswerRe: MFC and the MAIN method??? Pin
Phil J Pearson22-Oct-04 0:24
Phil J Pearson22-Oct-04 0:24 
AnswerRe: MFC and the MAIN method??? Pin
David Crow22-Oct-04 4:47
David Crow22-Oct-04 4:47 
GeneralRe: MFC and the MAIN method??? Pin
dharani26-Oct-04 22:53
dharani26-Oct-04 22:53 
GeneralRe: MFC and the MAIN method??? Pin
David Crow27-Oct-04 3:11
David Crow27-Oct-04 3:11 
Questionhow to create tab control Pin
vc-programmer-21-Oct-04 19:28
vc-programmer-21-Oct-04 19:28 
QuestionWhy I get a black screen while capturing screen? Pin
Guoguor21-Oct-04 17:35
Guoguor21-Oct-04 17:35 
I want to use the follow codes to capture screen ,but I get a black screen.
Please help me to find the errors!
thanks!
HWND hDesktopWnd=::GetDesktopWindow();
HDC hDesktopDC=::GetDC(hDesktopWnd);

HDC hDesktopCompatibleDC=CreateCompatibleDC(hDesktopDC);
HBITMAP hDesktopCompatibleBitmap=CreateCompatibleBitmap(hDesktopDC,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
SelectObject(hDesktopCompatibleDC,hDesktopCompatibleBitmap);

BitBlt(hDesktopCompatibleDC,0,0,GetSystemMetrics(SM_CXSCREEN)
,GetSystemMetrics(SM_CYSCREEN)
,hDesktopDC,0,0,SRCCOPY);
// InvalidateRect(NULL,false);

HDC hBmpFileDC=CreateCompatibleDC(hDesktopCompatibleDC);

HBITMAP hBmpFileBitmap=CreateDIBSection(hDesktopCompatibleDC,&bi,DIB_RGB_COLORS,&pBits,NULL,0);

SelectObject(hBmpFileDC,hBmpFileBitmap);

BitBlt(hBmpFileDC,0,0,width,height,hDesktopCompatibleDC,0,0,SRCCOPY);
// the fellow codes is save the bitmap
HANDLE hFile=CreateFile((unsigned short *)szFileName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);

bi.bmiHeader.biBitCount=16;
// bi.bmiHeader.biClrUsed=0;
bi.bmiHeader.biHeight=GetSystemMetrics(SM_CYSCREEN);
//GetHeight();
bi.bmiHeader.biWidth=GetSystemMetrics(SM_CXSCREEN);
//GetWidth();
bi.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
bi.bmiHeader.biPlanes=1;
bi.bmiHeader.biCompression=BI_RGB;
// bi.bmiHeader.biXPelsPerMeter=0;
// bi.bmiHeader.biYPelsPerMeter=0;
// bi.bmiHeader.biClrImportant=0;
DWORD bitSize=((bi.bmiHeader.biWidth*16)/8)*bi.bmiHeader.biHeight;
bi.bmiHeader.biSizeImage=bitSize;
bitHeader.bfType=((WORD)('M'<<8)|'B');
bitHeader.bfReserved1=0;
bitHeader.bfReserved2=0;
bitHeader.bfOffBits=(DWORD)(sizeof(BITMAPFILEHEADER)+bi.bmiHeader.biSize);
bitHeader.bfSize=bi.bmiHeader.biSizeImage+bitHeader.bfOffBits;
if(hFile!=INVALID_HANDLE_VALUE)
{
DWORD dwRet=0;
WriteFile(hFile,&bitHeader,sizeof(bitHeader),&dwRet,NULL);
WriteFile(hFile,&bi.bmiHeader,sizeof(bi.bmiHeader),&dwRet,NULL);
WriteFile(hFile,pBits,bi.bmiHeader.biSizeImage,&dwRet,NULL);
CloseHandle(hFile);
}
DeleteDC(hBmpFileDC);
DeleteDC(hDesktopCompatibleDC);
::ReleaseDC(hDesktopWnd,hDesktopDC);
DeleteObject(hBmpFileBitmap);
DeleteObject(hDesktopCompatibleBitmap);
AnswerRe: Why I get a black screen while capturing screen? Pin
YoSilver22-Oct-04 21:35
YoSilver22-Oct-04 21:35 
GeneralOnly Dialogbox getting popped up Pin
Raghunandan S21-Oct-04 17:34
Raghunandan S21-Oct-04 17:34 
Generalgive me samples for Screen capture with GDI,Thanks Pin
Guoguor21-Oct-04 17:24
Guoguor21-Oct-04 17:24 
GeneralRe: give me samples for Screen capture with GDI,Thanks Pin
David Crow22-Oct-04 4:49
David Crow22-Oct-04 4:49 
Generalusing CWebBrowser2 Pin
includeh1021-Oct-04 17:06
includeh1021-Oct-04 17:06 
GeneralEvent logging and viewer Pin
help_wanted21-Oct-04 16:48
help_wanted21-Oct-04 16:48 
GeneralHelp w/ Debugging please Pin
georgiek5021-Oct-04 16:22
georgiek5021-Oct-04 16:22 
GeneralRe: Help w/ Debugging please Pin
Christian Graus21-Oct-04 16:24
protectorChristian Graus21-Oct-04 16:24 
GeneralRe: Help w/ Debugging please Pin
georgiek5021-Oct-04 16:27
georgiek5021-Oct-04 16:27 
GeneralRe: Help w/ Debugging please Pin
Christian Graus21-Oct-04 16:30
protectorChristian Graus21-Oct-04 16:30 
GeneralSimple menu question. please help Pin
Jochum Wittebrood21-Oct-04 16:16
Jochum Wittebrood21-Oct-04 16:16 
GeneralRe: Simple menu question. please help Pin
dharani26-Oct-04 22:55
dharani26-Oct-04 22:55 
GeneralRe: Simple menu question. please help Pin
Tili2-Mar-06 4:13
Tili2-Mar-06 4:13 
Generalsetup Pin
hou_12621-Oct-04 16:07
hou_12621-Oct-04 16:07 
GeneralRe: setup Pin
Christian Graus21-Oct-04 16:22
protectorChristian Graus21-Oct-04 16:22 
GeneralRe: setup Pin
hou_12621-Oct-04 16:52
hou_12621-Oct-04 16:52 
GeneralRe: setup Pin
Christian Graus24-Oct-04 9:42
protectorChristian Graus24-Oct-04 9:42 

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.