|
Please wrap your code snippets with <pre> tags, and make sure the angle bracket in the for statement is correct. Otherwise, it makes for very illegible code. You would have noticed this had you clicked the Preview button.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
i'm really a beginner here, so hopefully somebody can help me. i'm
currently doing a dialog application for a IC tester(hardware). In this
application, it will send some vector(series of '1' and '0' ) to the IC
tester(hardware) and then after the testing it will return back a result
vector(series of '1' and '0' ) to the computer. Therefore, in the dialog,
it will hv a button to start the testing. Once the button is pressed, the
testing will begin and later in the dialog, it should display the input
vector and also the output vector( which looks like a square wave to
represent 1 or 0). The data for the vector can be taken from a file saved in text format.
The problem now are:
1)how do i display the vector in my dialog box? Should i create and list
box or picture to display the graph in the dialog?
2)is there anybody who knows how to draw a square wave by getting the
data from a file( the file contains a series of 1 and 0, and if 1, the
wave amplitude is high and if 0 it will show low). Which function do you
recommend me to use?
3) i also need to be able to zoom in/out to view the vector.
Thanks.
|
|
|
|
|
First, you have to separate properly everything: how the data is represented for example (in the file) has nothing to do with how it will be displayed on the screen and how it will be sent to your IC tester. So, basically, what you have is a list of 0 and 1 and you want to display them on the screen (and you have two separate lists).
Did you take a look at the link I gave you last time ? About the chart control I developed (see here[^] ) ? I think by tweaking it a little bit you will be able to achieve what you are looking for: have two traces displayed on the screen. Of course, you need to offset one of them (e.g., one is between 0 and 1 and the other is between 2 and 3) do that they don't overlap. But, you can simply hide the Y axis so that you won't see the values.
Of course, you can also do it yourself. But then, I would suggest to create a custom control (see articles on this website) and write all the code yourself (so you will need to draw everything yourself). Which can be quite long, specially if you are a beginer.
But, one thing that is really important (and that confuse a lot of beginers), is to separate things that are not related: the reading of the file must be separated from the way you display your data that must be separated by how you send your data to your IC...
|
|
|
|
|
Hi, I have a problem...
In my application there is a CEdit box and i put text in it, if I cancel this text the application return a Debug error...
There is some initialization that I must do?
Please help me
|
|
|
|
|
fabiotriolo wrote: if I cancel this text
What does 'cancel' mean ? What did you do ?
fabiotriolo wrote: the application return a Debug error...
What error exactly ?
|
|
|
|
|
Its not sufficient for answer
|
|
|
|
|
WhiteSky wrote: Its not sufficient for answer
humm Happy Eid Buddy!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And You
|
|
|
|
|
Im wondering we have two messages on same time
|
|
|
|
|
fabiotriolo wrote: if I cancel this text...
Which means what exactly.
If you have an edit control which must contain valid, non-empty data before the dialog can be dismissed, you should disable the OK button until such conditions exist.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I write text in my edit control...if I erase all text from the edit control, my application return this debug error:
DAMAGE: After Normal block(#97) at 0x003D2998
|
|
|
|
|
fabiotriolo wrote: I write text in my edit control...if I erase all text from the edit control, my application return this debug error:
could you show us your actual code?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And You
|
|
|
|
|
Can you show your code that has error
|
|
|
|
|
This is the code:
void CwpaguiDlg::OnEnChangeTextUtente()
{
//prendiamo il testo digitato
int len,i, nLineCount = utente.GetLineCount();
CString strText, strLine, str1Text;
for (i=0;i < nLineCount;i++)
{
len = utente.LineLength(utente.LineIndex(i));
utente.GetLine(i, strText.GetBuffer(len), len);
}
strText.ReleaseBuffer(len);
strLine.Format(TEXT("\"%s\""),strText);
|
|
|
|
|
fabiotriolo wrote: CString strText, strLine, str1Text;
for (i=0;i < nLineCount;i++)
{
len = utente.LineLength(utente.LineIndex(i));
utente.GetLine(i, strText.GetBuffer(len), len);
}
strText.ReleaseBuffer(len);
strLine.Format(TEXT("\"%s\""),strText);
you getting buffer many times but releasing only once.. that is cause of Crashing of you application...
code something like this to avoid crash
void CwpaguiDlg::OnEnChangeTextUtente()
{
//prendiamo il testo digitato
int len,i;
int nLineCount = utente.GetLineCount();
CString strText, strLine, str1Text;
for (i=0;i < nLineCount;i++)
{
len = utente.LineLength(utente.LineIndex(i));
LPTSTR pString = strText.GetBuffer(len );
utente.GetLine(i,pString , len);
strText.ReleaseBuffer();
strLine+=CString(_T("\n")+strText;
}
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And You
|
|
|
|
|
Hi,
Sorry to have started a new thread for an old problem.But there was no reply for a long time so I thought I should restart.
If this a problem I won't do it again.
int *pValue = new int;GetParent->SendMessage(MY_MESSAGE, 0, (LPARAM) pValue);
delete pValue;
In the handler function for MY_MESSAGE:
LRESULT MyParent::OnMyMessage( WPARAM wParam, LPARAM lParam )
{
*(int *) lParam = 123; return 0;
}
The above code was given to sent a message to the parent window and allocate memory for a variable which belongs to the parent.
Thanks for the above code.It was really useful
But can I make Message map of the form MY_MESSAGE and have a handler function OnMyMessage ?
Since message maps are something that are provided by Windows API and they can be generated through Class Wizard where messages and their corresponding functions are already given. Ex WM_KEYDOWN with function OnKeyDown()
Prithaa
|
|
|
|
|
Hi,
Actualy i can't understand u r problem.
The steps for sending a message from one class to another is as follows,
1. define the message
ie #define MY_MSG WM_USER + 1
2. Add the handler in u r parent class
ie in messge map
ON_MESSAGE( MY_MSG, OnMyMessage ) and the message handler
void Parent::OnMyMessage( WPARAM wParam_i, LPARAM lParam_i )
{
}
3. Send the message ie
GetParent->PostMessage( MY_MSG, wParam, lParam ));
You can use either SendMessage() or PostMessage() to send message.
rgds
aneesh
|
|
|
|
|
Hi,
Thanks for your reply.I understood what you wrote
and tried but I get this error.
error C2440: 'type cast' : cannot convert from 'void (__thiscall CVer2scratchView::*)(unsigned int,long)' to 'long (__thiscall CWnd::*)(unsigned int,long)'
Pointers to members have different representations; cannot cast between them
This error is on line
ON_MESSAGE(MY_MESSAGE, ONMYMESSAGE)
Can you try what it must be?
Prithaa
|
|
|
|
|
prithaa wrote: error C2440: 'type cast' : cannot convert from 'void (__thiscall CVer2scratchView::*)(unsigned int,long)' to 'long (__thiscall CWnd::*)(unsigned int,long)'
Pointers to members have different representations; cannot cast between them
This error is meaningless without also showing the offending piece of code.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
|
prithaa wrote: Since message maps are something that are provided by Windows API and they can be generated through Class Wizard where messages and their corresponding functions are already given. Ex WM_KEYDOWN with function OnKeyDown()
just have a look at ON_MESSAGE macro in MSDN or if you know Win32 too try overlaoding DefWindowProc
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And You
|
|
|
|
|
Hi,
i get a compile error, and i know the error
I have this situation
#include "B.h"
class A
{
B aBObject;
}
******************
#include "A.h"
class B
{
A *pointerToA;
}
During definition of A, B will be defined and uses A ( which is not already defined )
I have already used a #ifndef ... #define ...
Anyone a solution?
Thanks
|
|
|
|
|
In one of the .h-files, use forward declaration of the other class, i.e
class A; //Forward declaration
class B
{
A *pointerToA;
}
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Haupt.h
=======
#pragma once
#include "Einstellungen.h"
class Haupt
{
public:
Haupt(void);
~Haupt(void);
Einstellungen *Config;
void Applic();
};
Haupt.cpp
=========
#include "StdAfx.h"
#include ".\haupt.h"
Haupt::Haupt(void)
{
Config = new Einstellungen(this);
Config->Set();
}
Haupt::~Haupt(void)
{
}
void Haupt::Applic()
{
printf("APPLIC");
}
Einstellungen.h
===============
#pragma once
//#include "Haupt.h"
class Haupt;
class Einstellungen
{
public:
Einstellungen(Haupt *verb);
~Einstellungen(void);
void Set();
Haupt *Verbindung;
};
Einstellungen.cpp
=================
#include "StdAfx.h"
#include ".\einstellungen.h"
Einstellungen::Einstellungen(Haupt *Ver)
{
Verbindung = Ver;
}
Einstellungen::~Einstellungen(void)
{
}
void Einstellungen::Set()
{
Verbindung->Applic();
}
Your solution works only in an alone File, where all Definitions are togheter
But thanks !
|
|
|
|