|
Indrawati wrote:
Is there a way to automatically reposition ALL the things inside the dialog when the user maximizes the window
No.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
MFC doesn't come with a layout manager like Java. However, see this[^] and this[^] CP section for answers.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I just want to know the initializtion of the parameter lpCmdLine. Could you tell me how and where to find it?
thanks!
free like a bird
|
|
|
|
|
lpCmdLine is passed into your program from CRT initialization. The CRT just calls GetCommandLine.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thank you very much,Tim!
free like a bird
|
|
|
|
|
Hello,
I'm just wondering why your message subject is: "To Michael Dunn"?
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
It may be more appropriate to be "Dear Mr. Dunn"!
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Recently, I write a program.And I write a WinMain function for it. But I don't know where and how to initialize the parameters of the function. Should I to initialize them by myself? Or the system will intialize them?
Where can I find the initializtion of the parameters
hInstC,hInstP,lpCmdLine,nCmdShow?
the function is as follows:
int PASCAL WinMain(HINSTANCE hInstC, HINSTANCE hInstP, LPTSTR lpCmdLine, int nCmdShow)
{..................}
free like a Bird
|
|
|
|
|
|
Hello All,
I am new to C++ and am trying to do some DSP programming. I would like to write the following function
y(n) = (1-a)*x(n-1) + a*y(n-1)
The arguments to this function are all floats - "x", "y" and "a".
Could somebody help me with this?
|
|
|
|
|
I could help you if you can answer these 2 questions:
(1) is x a function (if so, what is it)?
(2) what's the definition of y(0) ?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks, Ravi.
To answer your questions, this function which I'll call SmoothingFunction, is called by another function by name, SmoothCoeffs().
I have two arrays, Coeff[] and Smooth[], each with 5 elements. Values in the array Coeff[] are "smoothed" and then stored in Smooth[].
Here is the SmoothCoeffs() function:
NUM_ITER is 5.
<br />
inline void cDSP::SmoothCoeffs()<br />
{<br />
float *nStart = &gnCoeff[mnCoeffIndex];<br />
float *nFin = &gnSmooth[mnCoeffIndex];<br />
<br />
for (int i = 0; i < NUM_ITER; i++)<br />
{<br />
SmoothingFunction(nStart, nFin, mnSmoothCoeff);<br />
}<br />
<br />
mnCoeffIndex += NUM_ITER;
<br />
if (mnCoeffIndex >= NUM_COEFF)<br />
mnCoeffIndex = 0;
}<br />
"x" represents an element of Coeff() and "y" represents an element of Smooth().
Hope that helps!
|
|
|
|
|
OK, so that implies x and y are simply floating point values and not functions. But then I'm confused by your original definition, viz:
y(n) = (1-a)*x(n-1) + a*y(n-1)
To me, that says y is a function of n , whose definition includes the value y(n-1) . This is pretty easy to code recursively, but then I need to know the exit condition (eg: y(0) is arbitrarily defined as some value). Assuming y(0) is zero, I think the function you want is:
#define EPSILON 0.0000001
double y
(float n,
float a,
float x)
{
if (fabs (n) < EPSILON)
return (0.0);
return ((1.0 - a)*x*(n - 1.0) + (a*y(n-1)));
} /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi Ravi,
I should've probably defined it as follows:
y[n] = (1-a)*x[n-1] + a*y[n-1]
y[n] and x[n] are the elements of two arrays, Smooth[] and Coeff[] respectively.
|
|
|
|
|
OK, it looks like you've answered your own question, then?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hello, Could somebody please post a very simple function which takes a file path as a function, and recursively lists all files and folders found under that path?
I've found a few other examples on the 'net, but they seem to be focused at older C compilers, and just won't compile under Visual Studio.
If somebody could please help out with this, I'd greatly appreciate it!!!
Thanks in advance,
--Jon
|
|
|
|
|
|
Well, sort of... I've seen that before, but I'm a newbie to C++, though very familiar with c-styled Perl, and could not boil down a simple recursive function from that to be used in a console app... Still so many things in that demo app that are so foreign to me, that I have a really hard time making heads and tales of it.
|
|
|
|
|
here's an example using the CFileFind class.
void MyClass::GetFiles(CString strPath,BOOL bRecurse)
{
CFileFind finder;
CString strFile;
BOOL bWorking = finder.FindFile(strPath + _T("\\*.*"));
while(bWorking)
{
bWorking = finder.FindNextFile();
if(finder.IsDirectory() && !finder.IsDots() && bRecurse)
{
strFile = finder.GetFilePath();
GetFiles(strFile,bRecurse);
}
if(!finder.IsDirectory && !finder.IsDots())
{
strFile = finder.GetFilePath();
}
}
}
you should be able to use the function like this:
GetFiles("C:\\MyProjects",TRUE);
this should get all the files in that directory and all subdirectories.
to only get the files with one folder, just call with a second parameter of false
[insert witty comment here]
bdiamond
|
|
|
|
|
I have a BYTE array of 4 and I want to convert it to a decimal..how is this done.
Example:
<br />
BYTE SomeHex[4];<br />
<br />
SomeHex[0] = 0x00;<br />
SomeHex[1] = 0x00;<br />
SomeHex[2] = 0x27;<br />
SomeHex[3] = 0x30;<br />
So how do I convert this array to a decimal of 10032?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Just FYI, if you're on an x86 machine, then the bytes are backwards.
You don't convert from hex to decimal, you just put the number in an int variable and use it. How you output the value (hex, octal, binary, etc.) isn't related to how the value is stored.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
So...and correct me if i'm wrong.....if I move Somehex to an int...like:
int intVal = SomeHex;
then the value in intVal will be 10032? I've tried this but I get a compiler error saying "cannot convert from BYTE[4] to int". And if I type cast it as an int then I get 0x0012f408 as a value, which is not right.
So can you explain more please?
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
How about
int i1 = (int)SomeHex[0];<br />
int i2 = (int)SomeHex[1];<br />
int i3 = (int)SomeHex[2];<br />
int i4 = (int)SomeHex[3];
or maybe try this:
int* intVal = (int*)SomeHex;<br />
int intVal2 = *intVal;
Haven't tested either one, so BEWARE. But hopefully one of these will work or get you on the right path.
[insert witty comment here]
bdiamond
|
|
|
|
|
Nope.....just returning a hex value of 0x30270000, which is not right.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
To store the bytes into an int , I would do:
BYTE by[4] = { 0x30, 0x27, 0, 0 };
int n;
n = *(int*) &by[0]; Keep in mind that the order of the bytes is CPU-specific. On x86 it's low->high as I showed above.
Tom Wright wrote:
And if I type cast it as an int then I get 0x0012f408 as a value, which is not right.
That's because a cast isn't a magical command that makes the compiler read your mind. You need to understand exactly what a cast does, and avoid just "throwing in casts" hoping to make it work. (This isn't a flame, it's a difficult subject, I know.)
Casting by to int returns the value of &by[0] , which in your case was 0x0012f408
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|