|
May be.I am using the fourcc code as mmioFOURCC('M', 'J', 'P', 'G').
How can we find whether we wrote a correct AVI file or not?
.AVI file size is 10 mb .
Also,AVIWriteStream function works fine.
So,I assumed that MJPEG frames were written into AVI container.
How to solve this?
|
|
|
|
|
hi
could u explain this?
I have implemented as following:
UINT_PTR test = (UINT_PTR)processedJpegData; //This is the data to be written into AVI
LPVOID p = reinterpret_cast<LPVOID>(test);
if(!g_bCreated)
{
AVISTREAMINFO streamInfo;
memset(&streamInfo, 0, sizeof(streamInfo));
streamInfo.fccType = streamtypeVIDEO;
streamInfo.fccHandler = mmioFOURCC('M', 'J', 'P', 'G');
//streamInfo.fccHandler = mmioFOURCC('X', 'V', 'I', 'D');
streamInfo.dwScale = 1001;
streamInfo.dwRate = 30000;
streamInfo.dwSampleSize = 0;
streamInfo.dwSuggestedBufferSize = 0 ;
SetRect(&streamInfo.rcFrame, 0, 0,0,0);/* 720, 480,frameInfo.m_width, frameInfo.m_height*/
HRESULT hrCreate = AVIFileCreateStream(m_pAVIFile, &m_pVideoStream, &streamInfo);
if (hrCreate!=AVIERR_OK)
return ;
BITMAPINFOHEADER *bi = new BITMAPINFOHEADER();
bi->biSize = sizeof(BITMAPINFOHEADER);
bi->biWidth = 720;
bi->biHeight = 480;
bi->biPlanes = 1;
bi->biBitCount = 16;
bi->biCompression = mmioFOURCC('M', 'J', 'P', 'G'); // 0 = BI_RGB
bi->biSizeImage = size;
bi->biXPelsPerMeter= 0;
bi->biYPelsPerMeter= 0;
bi->biClrUsed = 0;
bi->biClrImportant = 0;
HRESULT hrSetformat = AVIStreamSetFormat(m_pVideoStream, 0,&bi, 40);
if(hrSetformat != 0)
return;
g_nIndex = AVIStreamLength(m_pVideoStream);
g_bCreated=true;
}
HRESULT hrStreamWrite = AVIStreamWrite(m_pVideoStream, g_nIndex++, 1, p,size, AVIIF_KEYFRAME, 0, 0);
if (hrStreamWrite!=AVIERR_OK)
return ;
This executes successfully and creates the AVI file also.But the problem is in playing that AVI file.
|
|
|
|
|
I want to use the CHtmlEditView in my vc 6.0 project.
so i added the header file 'afxhtml.h' and then added the following line.
CHtmlEditView htmleditview_object;
then i compiled the project and its giving the error like
error C2501: 'CHtmlEditView' : missing storage-class or type specifiers.
what should i do?
How do i solve this problem?sunnyram
|
|
|
|
|
sunnyram wrote: CHtmlEditView
Is this a MFC project ?
|
|
|
|
|
yes this is the MFC project. sunnyram
|
|
|
|
|
Hi
I need to get enlightten with a concept in C++/vc++ designing....
This is an general question...may be more pertaining to design mechanism of any project
I am trying to find out a good way to or standard method or any standard way to handle all the errro scenerio in a project?
To be more specific, I am doing a project on a protocol analyser....Taking an aaccount of any kind of protocol, what are the good way of handling errors for the same...so that its more scalable,(means we can add more error cases or test cases later easily)
May be an header file where all errrors will be saved as define primitive and handle all of them in a function....Or any good kind of mechanism...
Please enlighten me with the same
thanks in advance
|
|
|
|
|
Use Exceptions[^] for all error situations. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
From experience I've settled on three classes:
1.CMessage: containing the description of an error, though a message doesn't have to describe just an error - "Application started" and "Application stopped", for example, can be included alongside "Widgit X fell over". Initially I used a .h file for this but migrated to using a .mc file as well, the .mc being compiled to produce a .rc resource file.
2.CEventLog: containing some means of logging a message. I started logging to a .txt file, moved to .html and now log to the Windows Event Log via the ReportEvent [^] function.
3.CExError which can be thrown and has a constructor which takes the error information and logs it.
The most productive tactic by far I found was to ensure the file and line numbers where the error occurred were included in the message by using macros such as:
#define AT __FILE__ ":" TOSTRING(__LINE__)
Importantly I found this was a maintainable and expandable (relatively easy to add or edit messages) strategy which:
1. Didn't obscure the actual point of the code (too much) with line after line of error handling.
2. Completely hid away logging of errors in the CExError constructor,
3. Moved away (to the catch block) the point at which any code written to recover needed to go.
So the actual code ended looking something like:
...
void someclass::somefunction(...)
{
try
{
if(!AttemptSomething(param1, param2)
{
throw CExError(MESSAGE_ID_1, "Context info", AT);
}
if(!AttemptSomethingelse(param1, param2)
{
throw CExError(MESSAGE_ID_2, "Context info", AT);
}
}
catch(CExError& err)
{
if(MESSAGE_ID_2 == err.MessageID)
{
MessageBox(err.Message);
}
}
return;
}
...
|
|
|
|
|
Hello,
I have an exe which launches a DLL inside a thread (using CreateInstance) that does some SQL process (retreive, update of data, etc.). Then this exe is launched by some trigger event which is asynchronous.
Now testing this on my environment (Windows XP Service Pack 3, Core 2 DUO @2.33GHz, 2GB of RAM) by triggering the event 2x simultaneously absolutely works. I can see in the log files I've created that the 2 DLL instance are processing in parallel.
The problem is with another server environment that we have (Windows Server 2003 R2 Service Pack 2, Xeon CPU @2.5GHz, 3GB of RAM). When I check the log files, up to the actual launch of the DLL was done simultaneously. But when it came to the DLLs, they seem to be working sequentially. After the 1st DLL is done (which is after 10 mins), then that is the time that the 2nd DLL starts in processing...
Anyone has any idea/clue on this problem? I'm on a dead-end right now. Thanks!
|
|
|
|
|
Could the two processes be queueing up to use the same resource? Maybe you only have one SQL connection available on the Server machine.
|
|
|
|
|
I have checked the SQL connection and the setting was 6. Then looking at the log files, the actual queuing up happens when the DLL's first function is called (way after the SQL connection/process is being triggered). The other DLL stops/waits until the first DLL is done.
It is highly likely that they're using the same resource... but any possibility that this is somehow the DLL's loading being queued up?
|
|
|
|
|
I mean ,
when the user disable or enable the adapter, my application could get the notification ,
I am an application level developor ,I know nothing about the Windows Driver Develop.
Is there any API or methods could work?
Thank you!
|
|
|
|
|
How many adapter do u expect? Величие не Бога может быть недооценена.
|
|
|
|
|
I expect to monitor any of the network adapter.
may be 2 ,may be only 1.
|
|
|
|
|
|
EverettJF wrote: when the user disable or enable the adapter, my application could get the notification...Is there any API or methods could work?
Have you looked at the ISensNetwork interface?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
thanks, may be I should get the COM
|
|
|
|
|
Hi, All!
I am developing an application to show the Text file. Now I derive a class from CScrollView. But I find that the view will flicker at the time I scroll the window when the text is too long to show in one page. So I declare a variable of CBitmap as a member of ScrollView class. Then in the member function of OnUpdate(), I declare a variable of CDC to create a compatibleDC and select the CBitmap into it. After that, I try to draw the view, save the view into CBitmap and Bitblt it into the Device Context of the window in the member funcation OnPaint().
Code:
class CEditorView : public CScrollView
{
......
private:
CBitmap m_bmpMem;
......
}
void CEditorView::OnUpdate(CView* , LPARAM , CObject* )
{
CSize sizeTotal;
GetViewSize(sizeTotal);
SetScrollSizes(MM_TEXT, sizeTotal);
CDC *pDC,memDC;
CBitmap *pOldBmp;
pDC = GetDC();
ASSERT(pDC != NULL);
memDC.CreateCompatibleDC(pDC);
memDC.SetMapMode(m_nMapMode);
m_bmpMem.CreateCompatibleBitmap(pDC,sizeTotal.cx,sizeTotal.cy);
pOldBmp = memDC.SelectObject(&m_bmpMem);
OnDraw(&memDC);
memDC.SelectObject(pOldBmp);
ReleaseDC(pDC);
InvalidateRect(NULL);
UpdateWindow();
}
void CEditorView::OnDraw(CDC* pDC)
{
CEditorDoc* pDoc = GetDocument();
ASSERT(pDoc != NULL);
}
void CEditorView::OnPaint()
{
CPaintDC dc(this);
CDC MemDC;
CBitmap *pOldBitmap;
CSize size;
OnPrepareDC(&dc);
size = GetTotalSize();
MemDC.CreateCompatibleDC(&dc);
MemDC.SetMapMode(m_nMapMode);
pOldBitmap = MemDC.SelectObject(&m_bmpMem);
dc.BitBlt( 0, -size.cy, size.cx, size.cy, &MemDC, 0, -size.cy, SRCCOPY );
MemDC.SelectObject(pOldBitmap);
CScrollView::OnPaint();
}
Question:
1. After I do as above, no text can be shown. I find that it will be shown only when I make the Message Declaration of OnPaint as comment. I don't know how to resolve it. I hope some one could be kind to tell me how to do. Thks!
2. What on earth the relation between OnPaint() and OnDraw()? Why the content can't be seen when I add the function OnPaint()?
Pls help me! Thks a lot!!
whitecloudsThere is some white cloud floating on the blue sky. That's the landscape I like.
modified on Monday, March 8, 2010 4:45 AM
|
|
|
|
|
whiteclouds wrote: What on earth the relation between OnPaint() and OnDraw()? Why the content can't be seen when I add the function OnPaint()?
Read the comments[^]
|
|
|
|
|
Thank Rage!
The message u provide is very useful. And I had make it clear.
By the way, I had resolved this problem. This problem was caused by the wrong parameters when calling dc.BitBlt(...) in the function OnPaint(). There is some white cloud floating on the blue sky. That's the landscape I like.
|
|
|
|
|
Commenting out your handler forces the Doc/View to call its own OnPaint method. In fact, drawing is handled by the OnDraw function in this case.
I presume that the CScrollView::OnPaint(); at the end of your handler erases the result of the code above it.
|
|
|
|
|
I need some hint/help here - I am getting this linker error after I build a DLL using " Regular DLL using shared MFC DLL" option in MFC DLL wizard.
My #include "OpenHR_DLL_Test\OpenHR_DLL_Test.h" is in stdafx.h
I do have the proper library in my Project Setting - Link -General - Object/Library modules as
OpenHR_DLL_Test/Debug/OpenHR_DLL_Test.lib.
I am using VC++ 6.0 and get no compiler errors, except the linker:
Linking...
OpenHR.obj : error LNK2001: unresolved external symbol "public: __thiscall COpenHR_DLL_TestApp::COpenHR_DLL_TestApp(void)" (??0COpenHR_DLL_TestApp@@QAE@XZ)
Debug/OpenHR.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
This is my first attempt on MFC DLL and I have no clue what I missed.
I am not to comfortable troubleshooting linker errors - so a general reference to "how to" would be also appreciated.
Thanks for your help.
Vaclav
|
|
|
|
|
0. It would be easier for you to use a MFC extension DLL at beginning.
Such DLLs do not have own applications instances...
1. Try to find any usage of COpenHR_DLL_TestApp in your code (OpenHR.cpp ?):
it should not be used outside of its owner DLL Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
Eugen,
please clarify "outside of its owner DLL".
I do access this DLL in
BOOL COpenHRApp::InitInstance()
{
....
That must be the "problem"?
So how do I use the DLL?
Forgive me these ignorat statements, but this is my first attemt to use DLL.
Vaclav
BTW I tryed MFC extension DLL and got same linker error. Not suprised if the above is correct.
|
|
|
|
|
The InitInstance() of your DLLs application is a task of the Loader,
that is a part of your Windows OS...
Usually -
the people use exported classes and functions of a DLL only
That is why
the wizard does not make the class of the DLLs application exported Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|