|
Are you working in embedded domain ?
Without any driver (USB ) i think it is not possible, u need to check the usb standards and write a simple driver..
If u can Dream... U can do it
|
|
|
|
|
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++
|
|
|
|
|
Can I download a file (like DirectX SDK) in chunks using CInternetSession/CHttpFile ? I built a program that downloads a whole file using CInternetSession/CHttpFile, but I can't do that whith huge files in just one session in dial-up connection. When I use CHttpFile::Seek(), the method returns immediately, but the subsequent CHttpFile::Read() takes as much time as reading from the beggining of the file. If not, is there another way to do it programmatically ?
|
|
|
|
|
if (GetAsyncKeyState(VK_XBUTTON1){
getasynckey doesn't disable the VK_
lets say, if i want xbutton1 to do something, it does, but will work simultaneously with the real mouse4 function, wich is backing pages in internet explorer
what could i do? thanks
|
|
|
|
|
tulio ribeiro wrote: if (GetAsyncKeyState(VK_XBUTTON1){
getasynckey doesn't disable the VK_
It is not supposed to be.
Can you explain, what you want to achieve.
|
|
|
|
|
i want to, like, anulate the key, not just get the state, and don't know how i should do
|
|
|
|
|
Can you explain a little clearer ? I really, cant understand, what you are trying to say.
|
|
|
|
|
the mouse4 works together with the mouse1
like, mouse4 will be hold, but i dont want that windows detect the mouse4 being hold, i just want mouse1 clicks, you know? thanks
|
|
|
|
|
Can you elobarate , what this mouse1 and mouse4 are ?
|
|
|
|
|
mouse1 = Left Click
mouse4 = xbutton1
|
|
|
|
|
Hi,
I need to know how to detect monitor resolution changes in my MFC application,
is there a WM_MONITORRESOLUTIONCHANGE message or similar that I can use to
check for this.
Many thanks.
|
|
|
|
|
Is WM_DISPLAYCHANGE helpfuls
|
|
|
|
|
Just what I was looking for, Thanks.
|
|
|
|
|
how to change the background color and text itemname in tabControl of mfc
|
|
|
|
|
|
i need some basic tutorials for TabControls in MFC. i need to know its creation and inserting items to the tab. anyone can help me
|
|
|
|
|
Here[^] we go.
Let us not listen to those who think we ought to be angry with our enemies, and who believe this to be great and manly. Nothing is so praiseworthy, nothing so clearly shows a great and noble soul, as clemency and readiness to forgive.
- Marcus Tullius Cicero
|
|
|
|
|
hi all,
I have got a problem with gluUnproject function. it works fine when there is no rotation. When i am giving rotation to my objects , it is giving me wrong coordinates( actually if i did rotation in X->Y->Z , it give me Z->Y->X).
i am using glReadPixels to read depth bits.
Anyone have any ideaaa???
Thanks in advance
Krishnan
If u can Dream... U can do it
|
|
|
|
|
hi i am having three radio buttons. if i click one button a dialog named IDD_NETWORKCONFIG have vto be opened. is there any function to do this
|
|
|
|
|
See this[^] tutorial.
/ravi
|
|
|
|
|
|
Hi
i have a function that gets a parameter of type (char **ptr)
i want to reallocate the space for this pointer (reduce or increase)
i have the followig code that raise an error when realloc change the original pointer
(*ptr)=(char *)realloc(*ptr,(originalLength+shift) * sizeof(char));
what is the problem in this line
note : its work fine when realloc returns the same pointer ?
thanks
|
|
|
|
|
I have a idea.
Are you sure ptr is not null (0) before you call realloc.
Because if ptr is NULL (0) then when you call *ptr is wrong.
you can add a code to report that ptr is null like this:
if(!ptr) MessageBox(0,"ptr is null","error",0);<br />
|
|
|
|
|
no its not null because when i debug the code
*ptr contains a string .
and kindly note the the realloc code that i added is used in many calls before for the same array
and its work fine when the array size is in smaller size but if i added some characters to it
then the allocation failed and i get the error (if i added one character !!)
i think this happen when realloc moves the array to another place and returns a new pointer ?
|
|
|
|
|
yeh, so how you add character to this pointer.
If possible, you can copy your code and paste here.
It is hard to explain if you only talk without code.
Ah, I think maybe you allocated memory before for *ptr by another function like *ptr = new char[]. Don't you do that. If it's, it's wrong.
-- modified at 3:41 Sunday 4th March, 2007
|
|
|
|