|
I have a series of 32 frames of data (all the same size in RGB format) which I would like to show in an AVI format. I don't need any audio, just video. I tried my luck at AVIFileInit() followed by AVIFileOpen(&pfile, name, OF_WRITE | OF_CREATE, NULL);
These worked (no error code) and AVIFileCreateStream(pfile, &ps, &strhdr); even worked.
When I made my data into a bitmap and tried to insert it with
hr = AVIStreamWrite(ps, i, 1, buff, bi.biSizeImage, AVIIF_KEYFRAME, NULL, NULL);
my luck ran out.
Presumably my strhdr isn't properly defined
memset( &strhdr, 0, sizeof(strhdr));
SetRect(&strhdr.rcFrame, 0, 0, (int) bi.biWidth, (int) bi.biHeight);
strhdr.fccType = streamtypeVIDEO;
strhdr.fccHandler = mmioFOURCC('M','S','V','C');
strhdr.dwScale = 1;
strhdr.dwRate = 1;
strhdr.dwQuality = -1; // default quality
I have no idea what MSVC in fccHandler means, for example.
I would like it to work like clock.avi in c:\windows which clicks away at 1 second clicks and it cycles back on itself. Does anyone have any suggestions on a tutorial?
Thanks,
Ilan
|
|
|
|
|
As usual, searching CodeProject articles is a good place to start - there is an article called "A simple interface to the Video for Windows API for creating AVI movies from individual images" (and here's the link: http://www.codeproject.com/audio/aviutil_.asp[^])
I have no idea how well this article works - it didn't get a great score, but it may give you some tips.
|
|
|
|
|
There is a way to associate a process to their sockets/connection without IP Helper?
[.KuRLiC.]
|
|
|
|
|
I have a somewhat obscure question about constructors, which I have not been able to find an appropriate answer for. I will preface my question by describing the situation:
I have a class representing a board that requires initialization. I know that the constructor should deal with storing addresses and other information about the board. However, should it also perform the initialization? In other words, can the constructor do more than just initialize member variables and perform an action, or is this considered bad programming practice?
If you can do initializations in the constructor, how do you return the result of that initialization? I need to know whether the physical board was actually located and configured. Can I pass a pointer (for example, initResultPtr) to the constructor such that it can update a variable that can be used to verify the result of the initialization?
Or should my class have a constructor that initializes all the member variables and an init() function that performs the physical board initialization and returns the result of that operation?
What it is the standard practice for this problem? If you have an opinion or can refer me to an accepted answer to this problem, I would be very grateful.
Kiernan
|
|
|
|
|
the constructor can perform whatever actions, but if it becomes very far from the purpose of initializating its instance, you can consider it is a bad pratice to do so. however, if you really need to do so, then write this code in another function, and call this function inside the constructor. of course, be careful that, if the function handles some uninitialized data members, you could go into trouble !
|
|
|
|
|
Generally speaking, I think constructors should be rather lightweight and only initialize variables. This is mostly because constructors can not return a status. Customary practice dictates that an exception is thrown on failure and that may not always be the prefered option. I prefer that any 'heavy lifting' be done in specific methods.
Regarding constructors failing : http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.2[^]
BTW - not that they're the final authority or anything, I just found them first in my search.
|
|
|
|
|
Hello comunity,
i look for a funktion for CString's, funktion who is not casesensitive!
My problem is that i do mutch with Files, and a search in them, but when i use
the funktion from CString::Find(); , i have an problem that they 'r casesensitive,
for example, when i look for string like "code", is not the same like "CODE"!
Is here any god function for search in strings
example:
<br />
CString csString = L"THE CODE PROJECT";<br />
int iPos;<br />
<br />
iPos = csString.Find(L"code");
iPos = csString.Find(L"CODE");
<br />
"code" is in string, but i recive -1 as return value!!!
thax for any help
break;
|
|
|
|
|
And what about converting the CString to upper or lower case first (with CString::MakeUpper and CString::MakeLower). If you don't want to modify the case of your string, you can first store it in a temporary string that you modify and work with it.
|
|
|
|
|
Hello Moonen,
in some case is this a good idea, but i can't change all file content, because this change the file, and i want to extract some parts of this file and store it
in a new varable for later to compare and some other functions!
but tanx for reply
break;
|
|
|
|
|
break; wrote: Hello Moonen
It is Cedric or Mr.Moonen.
break; wrote: but i can't change all file content, because this change the file
What Cedric meant is that you can use a temporary string which you can manipulate as you wish to get the index returned by the Find function, and then use this index on the real variable, namely this one:
break; wrote: store it
in a new varable for later to compare
~RaGE();
|
|
|
|
|
uups, sorry
thanx
break;
|
|
|
|
|
You could derive a custom string class from CString and overload the Find function:
class CMyCString : public CString
{
int Find(LPSTR lpszSub, int startAt=0);
}
int CMyCString::Find LPSTR lpszSub, int startAt)
{
CString s1 = *this; //make a copy of the current string
CString s2 = lpszSub;
//Make both strings uppercase
s1.MakeUpper();
s2.MakeUpper();
return s1.Find(s2,startAt);
}
You would then be able to use your custom class in place of CString.
|
|
|
|
|
hello,
thanx for reply, i try your sample!
regards
break;
|
|
|
|
|
Heya everybody. I got a question about WM_NCHITTEST...
I got a window with thick border and to prevent the user to resize it, I have to interpret WM_NCHITTEST and return HTBORDER when the mouse is over the border. However... the question is... is there an easy way to know when the mouse is over the border??? Or do I have to make some arithmetical checks for this? As far as I see the problem right now, the only way to determine when the mouse is over a border is to calculate by using the lParam of WM_NCHITTEST which tells me screen-relative X/Y position.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
I did a test for you, add the 3 lines:
//===============================
CMenu*pMu=GetSystemMenu(0);
pMu->RemoveMenu(SC_SIZE,MF_BYCOMMAND);
ModifyStyle(WS_MAXIMIZEBOX,0);
//===============================
the window will not be sized.
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
Thank you. I don't know if this would work on WIN32 though, since I am not using MFC.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Use the return value of the base class OnNcHitTest.
MFC
UINT CMyWnd::OnNcHitTest(CPoint point)
{
UINT border = CWnd::OnNcHitTest(point);
switch (border)
{
case HT_BOTTOM:
border = HTBORDER;
break;
...
}
return border;
} Win32
LRESULT CALLBACK WndProc (...)
{
switch (nMsg)
{
case WM_NCHITEST:
{
UINT border = ::DefWindowProc(hWnd, nMsg, wp, lp);
switch (border)
...
Well, you get the idea
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Yeap, I got it. I should have thought at the DefWindowProc stuff. Hrmph *pissed off on self*.
Thank you.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
WM_NCMOUSEMOVE
Nibu thomas
Software Developer
|
|
|
|
|
Hello Everybody!
I'v got a following problem.
I have an bmp image.
With a help of GDI+ function I conver it to tiff file (pure C++ code).
Everything worked, but the problem that generated tiff file has 96 dpi
resilution, when I want 300 dpi.
Is enybody know the way how to specify resolution in GDI+
when converting images?
|
|
|
|
|
|
I've looked at MS documentataion and have found only folowing 3 parameters:
//=========================================
TIFF encoder parameter Allowable values:
- Compression EncoderValueCompressionLZW
- EncoderValueCompressionCCITT3
- EncoderValueCompressionCCITT4
- EncoderValueCompressionRle
- EncoderValueCompressionNone
ColorDepth : 1, 4, 8, 24, 32
SaveFlag : EncoderValueMultiFrame
//=================================
Nothing about dpi
|
|
|
|
|
I've solved the problem!
The Idea is using Gdiplus:: Bitmap
instead of Gdiplus::Image
In this case there is a function Bitmap->SetResolution(REAL x, REAL y)
that allow to do it.
|
|
|
|
|
here is what I want to do:
I want to swap the some elements of an array so I want to make a function like that:
int arr[] // this array is initialized
...
swap( int a[])
{
//swap parameters
}
swap(arr); // use the function
printarr(arr); // print the resault
The question is: how should I pass the array to the function properly, so that it changes the values of arr outside of its body too?
|
|
|
|
|
void swap (int* array) { }
|
|
|
|