|
toxcct wrote:
When I call UpdateData(TRUE), IDC_MYEDIT is filled with the content of m_strEditText.
When I call UpdateData(FALSE), m_strEditText is affected with the content of IDC_MYEDIT.
No, that's backwards. Passing TRUE copies from the control to the variable. Your sample code is using the paramter correctly, however.
The first thing to check is that you call UpdateData(FALSE) in OnInitDialog() . You need to call that once before all other DDX operations. The wizard-generated code does this, so check that you didn't accidentally delete it.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Michael Dunn wrote:
so check that you didn't accidentally delete it.
First, i didn't delete anything from OnInitDialog() (and it is not the first time i program a dialog box), and moreover, the call of UpdateData() is made into CDialog::OnInitDialog() , not into mine...
secondly, my other handlers work well, and i just have this one that behaves strangely...
i really don't understand why, but i "very sure" that the problem comes from the call of that function...
... And as i don't want to mix the uses of UpdateDate() and SetWindowText()...
any tips ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hey,
I have a class (derived from CObject) containing variables (and functions). I put this class (Object) into a CObArray. Now I would create a copy of the class as a NEW Object (thus not only a copy of the pointer as with CObArray.copy).
Do I have to copy all Member of the class "by hand" or is there a more comfortable way.
Thanks in advance...
|
|
|
|
|
depends...
the objects, you copy them "by hand".
the pointers, you should allocate a new memory area to copy its content (otherwise, if you just copy the pointer, you will have 2 pointers - with so the same address inside - pointing to the same object). this will avoid modifying the same object when you think they have each theirs, and delete ing 2 times the same object.
That is for your own class members. For the base class (here, CObject), call its constructor before the instructions block (sorry, I lost the name of this place ) :
CMyClass::CMyClass(CMyClass& ref) : CObject() {
}
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi!
I wanna preserve "this" pointer's address to some member variable, so that, at some later stage, i can reuse this address.
If any one knows the solution (Visual C++'s reference), kindly inform me as soon as possible.
Thnx
Usman Arif
Usman Arif
|
|
|
|
|
I don't understand your question ?
this<code> is always available within the class.<br />
<br />
<br />
<pre>class MyClass;
class MyClass {
MyClass* m_pMyClass;
void DoSomething();
};
...
void MyClass::DoSomething()
{
m_pMyClass = this;
}<pre>
<hr><a href="http://www.thesorus.qc.ca">Maximilien Lincourt</a>
Your Head A Splode - Strong Bad</pre></pre>
|
|
|
|
|
You might also want to be careful that if you did store the address, you don't try to use it after the class is destroyed.
|
|
|
|
|
I have got a small problem with ActiveX control..When i place it inside activeX container, initially it sticks to the rectangle (previously in which ellipse is drawn by default). When i resize the drawing in onDraw(), it clips the outer parts and initially it displays the part in the default rectangle area whateva can come inside it. I need a tip to initialize the rectangular area with my own bounds .Please do reply, i am helpless in my final year project without getting to solve this problem , thanks.
|
|
|
|
|
Hi everyone outthere,
I have a regluar TTL Signal. Like this one:
Now i need to detect the distance between these two points:
This and This
\/ \/
----- ----- -----
| | | | | |
| | | | | |
--------| |---| |---| |---
Hope you understand what i mean ^^.
Here is a link to a drawing
http://www.cofan.co.kr/image/other/et05.gif
just look at the signal not at all the Data which stands there.
RedDragon2kx
|
|
|
|
|
not at all...
coy your scheme into a <pre></pre> block to let us see the spaces...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I need to get the time between
This This
\/ \/
|----| |----| |----|
| | | | | |
| | | | | |
-----| |----| |----| |----
Points. I hope it works now ^^
|
|
|
|
|
What are you trying to accomplish here? Is this a software project, or hardware? Do you have an input card that you're monitoring, or is this sampled data in a file?
"If it's Snowbird season, why can't we shoot them?" - Overheard in a bar in Bullhead City
|
|
|
|
|
It's a hardware device that I'm monitoring. It's a TTL Signal, I believe it's only produced by Transistors but I'm not sure. Sorry for my bad description.
|
|
|
|
|
Okay, that's clear. Now, what are you using to monitor it? Do you have a digital input card or analog? Are you digitizing samples into a file, or simply ones and zeroes? In either case the method is similar, though an analog sampling device takes a bit more work to decide when the signal state has changed.
Method 1:
Sample the signal at a fixed interval of time. How often depends on the accuracy of measurement required. Initialize a counter on the first falling edge, then increment it until the next falling edge is detected. Multiply the count by the time between samples.
Method 2:
As before, sample at regular intervals, depending on the accuracy needed. At the first falling edge, read the system clock and save the value. At the second, read the clock again, then calculate the difference between the two values.
Since it's not really clear yet what you are looking for, one efficient way to detect a state change - assuming you're looking at a stream of digital inputs, not digitized analog - is to XOR the current value with the previous value. If the result is true, and the current value is 0, you have just found a falling edge. If the result is true and the current value is 1, you've detected a rising edge. Anytime the result of the XOR is false, the values match and no state change has occurred.
Both methods will be somewhat unreliable under Windows, as you can't guarantee that some samples won't be missed or delayed because of other tasks grabbing the CPU just before a new sample is scheduled. This is an application where a hardware solution is easier and better to use. A simple gate circuit to enable or disable a fixed, accurate clock signal connected to a counter will do the trick. The only trouble with a hardware solution is that, while the actual measurement circuit is trivial, the interface required to make it readable by a PC involves a lot of overhead. Why not buy a device made for the purpose? Dataq (www.dataq.com[^]) makes a line of inexpensive modules which connect to a serial port and come with software to use them for various measurements of this sort.
Good luck!
"If it's Snowbird season, why can't we shoot them?" - Overheard in a bar in Bullhead City
|
|
|
|
|
First i'd like to say thank you for the help. I get the TTL Signal via the Line In Port in my Computer and the data is is processed with an FFT Algorithmus that i found on the internet and i wanted to use the points the FFT returns, is it possible ?
|
|
|
|
|
Interesting. How in the world did you find a way to access the LineIn on a sound card? I didn't know that it was possible. Or is this some kind of analog to digital converter card you have? There is no such thing as a Line In "port" on a PC, but sound cards have audio input jacks by that name.
If you are accessing data that can be FFT'd you should be looking at digitized analog voltages. If you want to work with the raw data, you could scan the data for peaks followed by minimums, then pick an arbitrary point halfway between them to call the transition point. The number of samples between high-to-low transitions divided by the sample rate (#samples / samples per second) will yield the time between transitions.
Simpler, though, if you have the FFT data available, is to simply locate the peak value and determine its frequency. Since this is frequency domain data, the peak represents the fundamental frequency of the input signal. That corresponds exactly with the period you're trying to determine. Each data point in the FFT output array contains the magnitude of the input signal due to a frequency that is a multiple or submultiple of the sample rate. Locating the peak will be easy - in a square wave such as you've illustrated, the fundamental component is half the peak value, and since it contains only odd harmonics there will be much smaller peaks at 3f0, 5f0, 7f0, etc. The inverse of the frequency of the largest value in the array is the period of the signal.
"If it's Snowbird season, why can't we shoot them?" - Overheard in a bar in Bullhead City
|
|
|
|
|
Thanks for your help You are right im using the Line In Jack at my Soundcard not the port (sorry, but I'm from Germany). I think i gonna maybe write an article about this Topic. ^^
|
|
|
|
|
RedDragon2k wrote:
I think i gonna maybe write an article about this Topic.
Cool!
I'd love to know how to access the soundcard hardware. It's a handy device for its intended purpose, but it would be much more useful if we could easily use its A/D and D/A converters for other uses.
"If it's Snowbird season, why can't we shoot them?" - Overheard in a bar in Bullhead City
|
|
|
|
|
Hi all
I want to use coInitializeSecurity() in my program
i included objbase.h and define win32_DCom but
i got an error Undeclared Identifier .the same problem with coCreateInstanceEx() . but there isnot any error with coCreateInstance().
thank you
|
|
|
|
|
Hi,my class definement is as follows:
class A
{
public:
A(){cout<<"A::A()"<
|
|
|
|
|
i'm not sure of the output, but the first thing i see is that you derive A and its destructor (A::~A() ) is not declared as virtual ...
i think so the output is:
A::A()
A::A()
B::B()
A::~A()
A::~A()
is is wrong ? (i did not compile to test, so i may have written an error, but that was the game, wasn't it ? )
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
bobi_zcl wrote:
what is the output result?why?
Why don't you step through it yourself and find out? Note that the code in main() won't work on VC7.x, the declarations of a and b will be treated as function prototypes, not variable declarations. If you use 7.x you'll need to change it to:
A a = A();
A b = B();
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I have problem with running my application on PCs with pentium IV processors. On AMD processors it runs without problems. When I analyzed the problem, I have found that memcpy function probably does not behave correct. Is this some compiler bug (I am using MS Visual .NET 2001) or something like memory aligment fault? On pentium IV application crashes with "memory protection fault". If I well understand MS article "Windows data alignment" memory aligment cannot cause application crash on pentium IV, it can only cause worse performance, so it is not probably this kind of problem.
|
|
|
|
|
Is your application multi-threaded? If so it could be a race condition.
Most Pentium 4 processors use HyperThreading (HT) technology. These Pentium 4 processors are multi-cored processors. They will behave differently than on a single core processor like the AMD chip range.
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 Walliams (Little Britain)
|
|
|
|
|
you are right, my application is multi-threaded. I use one thread for loading, this thread creates some data, which then the parent thread use. So if I load data in same thread as I will use them, then I solve the problem? Or is there some simple solution to conserve multi-threading and avoid this problem, some way to disable hyperthreading?
|
|
|
|