|
Dear Bikram
thanks for your reply. I will refer to the CreateFile() function.
I am using a parallel port interface and linking the A/D converter to the PC through a SCSI cable.
thanks
JB
|
|
|
|
|
I have bunch of files in *.cpp format ( written in VC++). Presently i read the data from a text file and run the program. I want to make a GUI ( using MFC or anything else) so that user can enter the data in the GUI and hence the program reads it from there..
Please give any suggestions and ways to do it..
|
|
|
|
|
ummm probably wanna go with MFC...create a dialog based app add text boxes or whatever and goto town...
Cheers
How do I print my voice mail?
|
|
|
|
|
Hi,
I'm a newbie working on an MFC app which needs to display a simple text file of results. I have searched google as well as codeproject, but am stumped as to how i can do this.
I am guessing i'll want to derive a class from CRichEditView, and add the text from there, but how do I add text?!
If anyone has any tips, or places i could look for an answer, it would be greatly appreciated.
Thanks,
Mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
How do you want to display your results...? What kind of results are they?
It would probabbly be much easier to dump your result to a listbox than using a rich edit.
How do I print my voice mail?
|
|
|
|
|
It's just a text file created by our backend that lists concentrations of different elements.
I want to display them similar to notepad, where the user can scroll up and down, to review, and print if desired.
listbox, eh? I'll look into that.
thanks.
mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
mike-o wrote:
I am guessing i'll want to derive a class from CRichEditView, and add the text from there, but how do I add text?!
Assuming the text is in a variable (e.g., CString ), you can simply call the rich edit control's SetWindowText() method.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Ah, that sounds like a good plan.
thanks!
mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
And you have not found my article http://www.codeproject.com/file/textfile.asp[^]? Shocking!
The class contains a member Load that directly loads the contents of a file to an edit control (or a listbox). And here ones takes time to carefully craft and upload code...
|
|
|
|
|
Hello dear programmers,
You can see me as a beginner, actually I know only what I need to know to make an application in Visual C++. I'm having an OOP problem using MFC now.
I give you a peace of code here so you know what I mean.
But first my question: My purpose is to make pointer to a class. For example, in my clientsocket Clisocket I want in my constructorparameter a pointer to the class CSockCliDoc. In a sample code wich it works fine, it is like this:
#include <wcesock.h>
class CSockCliDoc;
class CCliSocket : public CCeSocket
{
// Attributes
public:
// Operations
public:
CCliSocket(CSockCliDoc *pInDoc);
virtual ~CCliSocket();
// Implementation
protected:
private:
CSockCliDoc *pDoc;
};
What I don't understand is the second line:
class CSockCliDoc;
What is the purpose of this part of code . I know that if you want to create a new class, you begin with "class whatever" and than "{the rest of the code for wathever it is};"
Can anybody help me to understand why the second line is needed?
Thank you very much, I'm sorry for my bad English, I'm from Holland.
|
|
|
|
|
Anonymous wrote:
class CSockCliDoc;
class CCliSocket : public CCeSocket
{
CSockCliDoc is an ahead declaration. It means "I'm going to use a pointer to CSockCliDoc in the class declaration below, but I've not declared the class itself here. It is defined elsewhere."
Anonymous wrote:
Thank you very much, I'm sorry for my bad English, I'm from Holland.
That's not an excuse, you're supposed to speak good English there
|
|
|
|
|
Thanks Johan ,
But that "ahead declaration" is that a standard C++ technique, or do they use it only in MFC?
Can you give me some links where I can get more information about ahead declaration?
I'll do my best to speak english well
|
|
|
|
|
|
Forward declaration is standard, at least in all of the C++ compilers I've used. It has nothing to do with MFC.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
You need to click faster
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Wow guys,
You are wonderful, you are really great helpers!!
Thank you very very much and may God bless you!
Peace!!
|
|
|
|
|
Hai all,
I am doing a project involving graphical drawings.
In my project, I add every drawn elements in a pointer list.
And, while drawing a new element ie on every mouse move, i redraw all the elements in the pointer list and draw the current elements with the new coordinates.
This slows down my application.
I tried Double buffering and XOR techniques but in vain.
Is there any other way to draw an element without disturbing other drawn elements?
Please help me.
With Thanks,
Arun Chakaravarthy
|
|
|
|
|
While dragging, you might want to try to invalidate only the original and new positions of the object(s) moved in the window - this way you redraw just a part of the screen.
You could also try to analyze what the bottleneck might be. I'm redrawing all of the screen in my vector editor http://www.codeproject.com/miscctrl/diagrameditor.asp[^] Hm, it starts to sound like I'm shamelessly plugging for that beast... Anyway, feel free to take a look at it and its' sibling http://www.codeproject.com/miscctrl/flowcharteditor.asp[^] - both redraw all objects as soon as one is moved, and neither of them displays any dramatic performance problems. They double buffer, btw.
If you are shuffling bitmaps, you might have another situation, but make sure that the access to the objects is as simple as possible, and that it is the drawing itself that is the problem, before you start optimizing the drawing rect.
|
|
|
|
|
Is there a function to find the differences between two time structs of type _timeb ? If not, is there any easy way to show atleast the hundreth's of seconds between to time_t values?
Whenever I do something below I always get 0's, it can't always be that exact:
double diff;
diff = difftime(end, start);
char msg[] = "blah blah blah runtime %.10f second(s).";
- Nick Parker My Blog | My Articles
|
|
|
|
|
time_t only has 1-second resolution, so you'll never get a different less than 1 second (unless it's 0). Your best bet would probably be to use FILETIME , which is a 64-bit number with 100ns resolution. It's a plain number so calculating differences is easy. (I think the CRT time structs are incredibly clunky and I avoid them as much as possible.)
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Laugh it up, fuzzball.
|
|
|
|
|
Thanks Mike, are there other functions other than GetFileTime that you would suggest, I am not working with files so I won't have a HANDLE for it?
Nevermind, I think SystemTimeToFileTime should work. Thanks again for pointing me in the right direction.
- Nick Parker My Blog | My Articles
|
|
|
|
|
First off apols if this is in the wrong section i am new here
I have this code now and try as i may i cannot get the random number to change it is always 41 when it should be between 0-100. I am not that good at C++ and would appreciate any help can i please reinforce the basis that my knowledge is very basic thanks for any help guys.
#include <iostream.h>
#include <stdlib.h>
int main(void)
{
// declare our variables
// Guess entered by user and random number
int guess, random;
random = rand();
// Creates a loop for the main program
do
{
cout << "My High-Low game!\n\n";
cout << "Please enter a number between 0 and 100: ";
cin >> guess;
cout << "You entered " << guess << "!\n";
if (guess == random)
{
cout << "Correct guess, the answer is " << guess << "!\n";
}
else
{
if (guess > random)
{
cout << "Your guess is too high!\n";
}
else
{
cout << "Your guess is too low!\n";
}
}
// Terminating condition for the loop
// Program stops when the guess equals the random number
}
while(guess!=random);
// This command pauses the program
system("PAUSE");
return 0;
}
This Better ******* Work!
|
|
|
|
|
Put the line
random = rand();
in the do while block
and better add this to the start of the main
srand(time(NULL));
this way the seed is randomly generated too
(you wont start with the same population over and over again)
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
You need to call srand() first, otherwise rand() will always return the same number. A line like
srand((unsigned)time(NULL));
before the call to rand() should do the trick.
|
|
|
|
|
To elaborate a bit more on the previous response, it is recommend that you first seed the random number generator. If you wish a consistent pattern of values then always seed with the same value. If not then you can use this :
srand( time(NULL) % RAND_MAX );
to obtain values between 0 and 100 then you can do this :
random = rand() % 101;
The modulus operator returns the remainder of the division operation of the two numbers. This has the effect of clamping the return value between 0 and one less than the dividend.
__________________________________________
a two cent stamp short of going postal.
|
|
|
|