|
See the "Extras" section of this article.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
1.Create a CFont object( This object should not be created with in local scope. Its better to create this object as memeber variable of the class )..
2. call CreateFont function of this object
3. Create the member variable of the static control( for this u have to change the id of static control from IDC_STATIC to some other name )
4. Call the SetFont function of the static control to change the font.
nave
|
|
|
|
|
Thanks NaVin.
Leya
|
|
|
|
|
Hi All,
Using Timeline in DirectShow Editing services I did video and audio mixing.
I want to save it in avi format.
This is the code I used to save it. But it is not saving anything localy. At run time it creates an empty avi file.
It disappears automatically.
IRenderEngine *pRender = NULL;
hr = CoCreateInstance(CLSID_RenderEngine, NULL, CLSCTX_INPROC,
IID_IRenderEngine, (void**) &pRender);
hr = pRender->SetTimelineObject(pTL);
hr = pRender->ConnectFrontEnd( );
CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC,
IID_ICaptureGraphBuilder2, (void **)&pBuilder);
// Get a pointer to the graph front end.
IGraphBuilder *pGraph;
pRender->GetFilterGraph(&pGraph);
pBuilder->SetFiltergraph(pGraph);
// Create the file-writing section.
IBaseFilter *pMux;
pBuilder->SetOutputFileName(&MEDIASUBTYPE_Avi,
OLESTR("Output.avi"), &pMux, NULL);
long NumGroups;
pTimeline->GetGroupCount(&NumGroups);
// Loop through the groups and get the output pins.
for (i = 0; i < NumGroups; i++)
{
IPin *pPin;
if (pRender->GetGroupOutputPin(i, &pPin) == S_OK)
{
IBaseFilter *pCompressor;
// Create a compressor filter.
IBaseFilter *pCompressor;
CoCreateInstance(CLSID_AVICo, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&pCompressor);
pGraph->AddFilter(pCompressor, L"Compressor");
// Set compression parameters.
IAMStreamConfig *pStreamConfig = NULL;
IAMVideoCompression *pCompress = NULL;
AM_MEDIA_TYPE *pmt;
pBuild->FindInterface(NULL,NULL,pCompressor,IID_IAMStreamConfig, (void**)&pStreamConfig);
pStreamConfig->GetFormat(&pmt);
if(pmt->formattype == FORMAT_VideoInfo)
{
((VIDEOINFOHEADER *)(pmt->pbFormat))->dwBitRate = 10000;
pStreamConfig->SetFormat(pmt);
}
pStreamConfig->QueryInterface(IID_IAMVideoCompression, (void**)&pCompress);
pCompress->put_KeyFrameRate(4);
Note: I am converting BMPs into video file and adding wav file for audio.
Please help me on this.
Thanks in advance
Poornima
// Connect the pin.
pBuilder->RenderStream(NULL, NULL, pPin, pCompressor, pMux);
pCompressor->Release();
pPin->Release();
}
}
|
|
|
|
|
Just a thought, I'm just guessing here:
Is it possible that the output file isn't closed properly? That usually gives a zero-length file.
Is there such a thing as:
pBuilder->Release();
?
|
|
|
|
|
Hi
Does anyone know how to set the default theme to an application
I write a SDI applications, they are always in XP Style, can
the application be set to start up in a different theme ??
thanks
Si
|
|
|
|
|
u can use SetWindowTheme function
nave
|
|
|
|
|
|
|
if I have rand() function which returns integers within 0...MAX, how to convert them to smaller scale like thru % or / operator or something very simple to say whole range of 0...MAX to scale to just 0,1,2,3 four numbers etc...
9ine
|
|
|
|
|
Your question is not so clear...
Did you mean that you want to get a small range of random numbers? Then use
num = rand() % MAX;
where MAX can be the upper limit.
- NS -
|
|
|
|
|
rand() % (MY_MAX+1) if you want the values between [0 : MY_MAX]
otherwise, like this :
(rand() % (MAX_BOUND - MIN_BOUND + 1)) + MIN_BOUND
|
|
|
|
|
Use this:
MINVAL + rand()%(MAXVAL-MINVAL)
Where MINVAL and MAXVAL are the range for your number.
|
|
|
|
|
thats good for splitting range of 0...MAXRAND to adjacent regions but how to split it to
MAXVAL=4
MAXRAND=100
[0...24][25...49][50...74][75...99] whole MAXRAND range divided to 4 regions
so if number from range [0...24] will result in 0, [25...49] in 1, etc...
if this will get more random like seq of 0,1,2,3 numbers MAXVAL-1
9ine
|
|
|
|
|
I don't understand what you are trying to do. When you want a random number, in general you want it to be between two bounds. What is the purpose of having several 'regions' ? And how to use that ? I mean if you to retrieve a random number from the 3 region, you know that this will be between 50 and 74. So, where is the problem ?
|
|
|
|
|
to not to produce
if(r<a)
else if(r="">=A && r<b)
else if(r="">=B && r
|
|
|
|
|
Are you talking about this?
(rand()%MAXRAND)%MAXVAL
Well,... It's the same of:
rand()%MAXVAL
Have a nice code day
|
|
|
|
|
I wanted to know if say in the case of MAXVAL=4 rand()%MAXVAL will result in spliting our 0...MAXRAND into:
rand range 0...15:
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
rand()%MAXVAL range:
0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3
this looks as we splitted our 0..MAXRAND range to adjasent quartets of 0,1,2,3 any number from 0..MAXRAND will fal into this range
but if the division of 0...15
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
to the sequence:
0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3
in first case rand val 6 will result in value of 2
in second 6 will result in 1
9ine
|
|
|
|
|
OK, I understand what you mean,
but we are talking about random numbers: so why we have to look how the algorithm are generating the numbers, and the numbers correspondances or order?
You want numbers from 0 to 3? well... use rand()%4 .
And don't put your eyes on how it works: the importatest think is that it works!
If you want that the distribution of the numbers remains the same you have to use something more complex (and slower) like this:
int((double(rand())/MAXINT)*MAXVALUE)
to get a number from 0 to MAXVALUE-1 related to the entire output range of rand()
but rand() generate numbers on an uniformally distribution, so nothing is changing between the different methods.
Hope it helps.
Have a nice code day
|
|
|
|
|
yes exactly uniform distribution.
we can do this by making array of indices:
0,0,0,0,0,1,1,1,1,1,2,2,2,2,2,... N, N=MAXRAND
so the rand() value will be the index to array, but it needs the array, and time consuming, and if we change MAXVAL often it needs array recomposed etc.
but with int((double(rand())/MAXINT)*MAXVALUE) we also need to use smart rounding as int() round 3.9 and 3.1 to 3, which will inlude more computation
apparantly rand()%MAXINT will be the best choice
9ine
|
|
|
|
|
hai to all
i have a problem in retieving a registry key value.for this i have used
RegNotifyChangeKeyValue function which helps to identify which key has got changed.
but now my problem is what is the return value .and what does it represent.and how can i use the return value for further processing.since i have to develop an application which monitors any selected registry key
can any one help this by giving an example
|
|
|
|
|
Per MSDN:
fAsynchronous
[in] Specifies a flag that indicates how the function reports changes. If this parameter is TRUE, the function returns immediately and reports changes by signaling the specified event. When this parameter is FALSE, the function does not return until a change has occurred.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
hi
I want to check the privileges given for a specific user(in WinXP).I had a look at LookupAccountName() but is just retrieves the SID.
But I want to check
1)Whether the user has sufficient privileges(like Registry Privileges or Write Privileges...) over the system or not.
2)Whether the user belongs to particular domain (though i think LookupAccountName() Would suffice for this )
Any Sample Code or Links would do fine..
Thanx in advance
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
-- modified at 7:39 Tuesday 18th April, 2006
|
|
|
|
|
QuickDeveloper wrote: 1)Whether the user has sufficient privileges(like Registry Privileges or Write Privileges...) over the system or not.
Check out LookupPrivilegeValue() .
QuickDeveloper wrote: 2)Whether the user belongs to particular domain (though i think LookupAccountName() Would suffice for this )
Use NetWkstaUserGetInfo() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|