Click here to Skip to main content
15,888,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow do you Find out(copy filenames) that is in a directory WITHOUT using the CFileDialog in MFC VS2008 C++ Pin
Larry Mills Sr18-May-08 5:46
Larry Mills Sr18-May-08 5:46 
AnswerRe: How do you Find out(copy filenames) that is in a directory WITHOUT using the CFileDialog in MFC VS2008 C++ Pin
Nelek18-May-08 7:24
protectorNelek18-May-08 7:24 
GeneralRe: How do you Find out(copy filenames) that is in a directory WITHOUT using the CFileDialog in MFC VS2008 C++ Pin
Larry Mills Sr18-May-08 9:34
Larry Mills Sr18-May-08 9:34 
GeneralRe: How do you Find out(copy filenames) that is in a directory WITHOUT using the CFileDialog in MFC VS2008 C++ Pin
Michael Schubert18-May-08 12:20
Michael Schubert18-May-08 12:20 
GeneralRe: How do you Find out(copy filenames) that is in a directory WITHOUT using the CFileDialog in MFC VS2008 C++ Pin
Nelek18-May-08 12:39
protectorNelek18-May-08 12:39 
QuestionRe: How do you Find out(copy filenames) that is in a directory WITHOUT using the CFileDialog in MFC VS2008 C++ Pin
David Crow19-May-08 4:41
David Crow19-May-08 4:41 
AnswerRe: How do you Find out(copy filenames) that is in a directory WITHOUT using the CFileDialog in MFC VS2008 C++ Pin
Larry Mills Sr19-May-08 16:43
Larry Mills Sr19-May-08 16:43 
QuestionDrawing a bitmap on DC created by BYTE* array Pin
TalSt18-May-08 3:29
TalSt18-May-08 3:29 
I wrote the following lines in order to draw a bitamp on DC created by BYTE* array:


#define BPP 32

// Initialize the bitmapinfo header
int nBitmapInfoSize = sizeof(BITMAPINFOHEADER) ;
memset(&m_bitmapInfo, 0, m_nBitmapInfoSize);

// Save size for drawing later.
int nBitPP = BPP / 8;
int nImageWidth = nWidth;
int nImageHeight = nHeight;
int nImageSize = nImageWidth * nImageHeight * nBitPP;

// Allocate memory for byte array and initialize it
BYTE* pbtImageArray = new BYTE [nImageSize];
memset(m_pbtImageArray, 0x0000, nImageSize);

for (int i = 0; i < nImageSize - nBitPP; i+=nBitPP)
{
pbtImageArray[i] = 0x0000;
pbtImageArray[i+1] = 0x0000;
pbtImageArray[i+2] = 255;
pbtImageArray[i+3] = 0x0000;

}

// Populate bitmapinfo header
BITMAPINFO bitmapInfo; // Bitmap info
bitmapInfo.bmiHeader.biSize = nBitmapInfoSize;
bitmapInfo.bmiHeader.biWidth = nImageWidth;
bitmapInfo.bmiHeader.biHeight = nImageHeight;
bitmapInfo.bmiHeader.biPlanes = 1;
bitmapInfo.bmiHeader.biBitCount = BPP;
bitmapInfo.bmiHeader.biSizeImage = nImageSize;
bitmapInfo.bmiHeader.biCompression = BI_RGB;

// Create bitamp
HBITMAP hbmp = CreateDIBSection( pCDC->GetSafeHdc(),
&bitmapInfo,
DIB_RGB_COLORS,
(void**)pbtImageArray,
NULL,
0);

HDC hBitmapDC = CreateCompatibleDC(pCDC->GetSafeHdc() );

HBITMAP hOldBitmap = (HBITMAP)SelectObject(hBitmapDC, hbmp);

StretchBlt( pCDC->GetSafeHdc(), nWindowX, nWindowY, nWindowWidth,
nWindowHeight, // Destination
hBitmapDC , nRegionX, nRegionY, nRegionWidth,
nRegionHeight, // Source
SRCCOPY);

SelectObject(m_hBitmapDC, hOldBitmap);



Do you know why this draw black image and not my BYTE* array?

Thanks!Rose | [Rose]
AnswerRe: Drawing a bitmap on DC created by BYTE* array [modified] Pin
Baltoro18-May-08 12:20
Baltoro18-May-08 12:20 
AnswerRe: Drawing a bitmap on DC created by BYTE* array Pin
Dan18-May-08 13:31
Dan18-May-08 13:31 
AnswerRe: Drawing a bitmap on DC created by BYTE* array Pin
TalSt18-May-08 19:27
TalSt18-May-08 19:27 
Questionfile accessing problem Pin
Chandrasekharan P18-May-08 3:26
Chandrasekharan P18-May-08 3:26 
AnswerRe: file accessing problem Pin
Nelek18-May-08 7:15
protectorNelek18-May-08 7:15 
AnswerRe: file accessing problem Pin
chandu00418-May-08 19:53
chandu00418-May-08 19:53 
QuestionReading Non-Ole File Property Pin
tprakash18-May-08 3:00
tprakash18-May-08 3:00 
AnswerRe: Reading Non-Ole File Property Pin
thonti29-May-08 23:41
thonti29-May-08 23:41 
AnswerRe: Reading Non-Ole File Property Pin
thonti9-Jun-08 3:50
thonti9-Jun-08 3:50 
Questioninvalid number of parameters in ActiveX Pin
samira forooghi18-May-08 0:37
samira forooghi18-May-08 0:37 
AnswerRe: invalid number of parameters in ActiveX Pin
Nelek18-May-08 0:39
protectorNelek18-May-08 0:39 
GeneralRe: invalid number of parameters in ActiveX Pin
samira forooghi19-May-08 1:55
samira forooghi19-May-08 1:55 
AnswerRe: invalid number of parameters in ActiveX Pin
prasad_som18-May-08 1:04
prasad_som18-May-08 1:04 
QuestionGetControlUnknown Pin
subramanyeswari18-May-08 0:08
subramanyeswari18-May-08 0:08 
AnswerRe: GetControlUnknown Pin
JudyL_MD18-May-08 12:39
JudyL_MD18-May-08 12:39 
QuestionDraw on desktop Pin
capint17-May-08 23:06
capint17-May-08 23:06 
AnswerRe: Draw on desktop [modified] Pin
Nelek17-May-08 23:47
protectorNelek17-May-08 23:47 

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.