Click here to Skip to main content
16,006,475 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: cmdichildwnd problem Pin
prithaa4-Mar-07 22:57
prithaa4-Mar-07 22:57 
GeneralRe: cmdichildwnd problem Pin
baerten4-Mar-07 23:27
baerten4-Mar-07 23:27 
GeneralRe: cmdichildwnd problem Pin
prithaa5-Mar-07 0:21
prithaa5-Mar-07 0:21 
QuestionTo copy folder to pendrive Pin
Vjys4-Mar-07 17:21
Vjys4-Mar-07 17:21 
AnswerRe: To copy folder to pendrive Pin
jk chan4-Mar-07 17:32
jk chan4-Mar-07 17:32 
GeneralRe: To copy folder to pendrive Pin
Vjys4-Mar-07 22:11
Vjys4-Mar-07 22:11 
GeneralRe: To copy folder to pendrive Pin
jk chan4-Mar-07 22:55
jk chan4-Mar-07 22:55 
Questionbitmap problem Pin
Zapacila4-Mar-07 12:57
Zapacila4-Mar-07 12:57 
Hi

i run into this code.. :

void CVidTestDlg::OnCapture()
{
CString Filter;
CString Filename;
CRect Rect;

Filter = "Bitmap Files (*.bmp)|*.bmp|AVI Files (*.avi)|*.avi||";

CFileDialog FileDlg(FALSE, "BMP", NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
Filter,
this);

if (FileDlg.DoModal() == IDOK)
{
RedrawWindow();

Filename = FileDlg.GetPathName();

Capture(m_VFWImageProc, Filename);

m_VideoDisplay.GetWindowRect(Rect);
ScreenToClient(Rect);

m_VFWImageProc.EnablePreviewVideo(*this, Rect.TopLeft().x,Rect.TopLeft().y);
}
}



BOOL Capture(CVFWImageProcessor &ImageProc, LPCTSTR Filename)

{
ULONG Length = 0;
CFile File;
BOOL Ret = FALSE;
CHAR Ext[_MAX_EXT];

_splitpath(Filename,NULL,NULL,NULL,Ext);

if (stricmp(Ext,".avi") == 0)
{
Ret = ImageProc.CaptureAVI(Filename,4.0,10,10);
}
else if (stricmp(Ext,".bmp") == 0)
{
BITMAPINFO *Bitmap = NULL;
BITMAPFILEHEADER bfh;

ImageProc.CaptureDIB(&Bitmap,0,&Length);

if (Bitmap)
{
File.Open(Filename,CFile::modeCreate |
CFile::modeWrite |
CFile::shareDenyNone |
CFile::typeBinary);

bfh.bfType = 0x4d42; // 0x42 = "B" 0x4d = "M"
bfh.bfSize = (DWORD) Length + sizeof(BITMAPFILEHEADER);
bfh.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) +
sizeof(BITMAPINFOHEADER) +
Bitmap->bmiHeader.biClrUsed * sizeof (RGBQUAD);
bfh.bfReserved1 = 0;
bfh.bfReserved2 = 0;



File.Write(&bfh,sizeof(bfh));
File.Write(Bitmap,Length);

File.Close();

Ret = TRUE;

delete Bitmap;
}

this is the code that is resposible for capturing a image from usb webcam and saving to hard driver

Function : CaptureDIB
Arguments : Bitmap (output) - Pointer to bitmap to receive image.
If *Bitmap = NULL, then allocation will
be performed automatically.
BitmapLength (input) - Size of Bitmap if *Bitmap is not NULL.
RetBitmapLength (output) - Actual size of image.
Return : TRUE Success, FALSE Failed.
Description: Captures a DIB image from video capture device.

As you see he uses some structs BITMAPINFO BITMAPFILEHEADER wihich togheter is the bitmap file. and writes it down to file.

now my problem...

i must make a dll wich exports symbols and a function within it , lets call it Capture that will return a bitmap (whole bitmap including header)

but i dont know how to copy the both struct within a buffer or something and return it.

can someone help. does someone get me..

sorry for bad explanation . i`m not champion at c++

Questiondownloading huge files Pin
aljodav4-Mar-07 11:23
aljodav4-Mar-07 11:23 
Questiongetasynckeystate problem Pin
tulio ribeiro4-Mar-07 7:45
tulio ribeiro4-Mar-07 7:45 
AnswerRe: getasynckeystate problem Pin
prasad_som4-Mar-07 19:54
prasad_som4-Mar-07 19:54 
GeneralRe: getasynckeystate problem Pin
tulio ribeiro5-Mar-07 1:19
tulio ribeiro5-Mar-07 1:19 
QuestionRe: getasynckeystate problem Pin
prasad_som5-Mar-07 6:03
prasad_som5-Mar-07 6:03 
AnswerRe: getasynckeystate problem Pin
tulio ribeiro5-Mar-07 8:43
tulio ribeiro5-Mar-07 8:43 
QuestionRe: getasynckeystate problem Pin
prasad_som5-Mar-07 17:38
prasad_som5-Mar-07 17:38 
AnswerRe: getasynckeystate problem Pin
tulio ribeiro6-Mar-07 4:32
tulio ribeiro6-Mar-07 4:32 
QuestionHow to detect monitor resolution changes ? Pin
Atom4-Mar-07 3:01
Atom4-Mar-07 3:01 
AnswerRe: How to detect monitor resolution changes ? Pin
Hamid_RT4-Mar-07 5:04
Hamid_RT4-Mar-07 5:04 
GeneralRe: How to detect monitor resolution changes ? Pin
Atom4-Mar-07 6:34
Atom4-Mar-07 6:34 
QuestionBackground color- tab Pin
prathuraj4-Mar-07 2:15
prathuraj4-Mar-07 2:15 
AnswerRe: Background color- tab Pin
Hamid_RT4-Mar-07 5:12
Hamid_RT4-Mar-07 5:12 
QuestionTab control mfc Pin
prathuraj3-Mar-07 23:22
prathuraj3-Mar-07 23:22 
AnswerRe: Tab control mfc Pin
Rajesh R Subramanian3-Mar-07 23:28
professionalRajesh R Subramanian3-Mar-07 23:28 
QuestionOpengl gluUnproject Pin
jk chan3-Mar-07 22:51
jk chan3-Mar-07 22:51 
Questionshow dialog Pin
prathuraj3-Mar-07 21:49
prathuraj3-Mar-07 21:49 

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.