|
don't give up so fast ...
remove the line
m_strMessage = "Place a message here";
m_bShowMsg = TRUE;
m_bShowPgm = TRUE;
m_bEnableMessage = TRUE;
m_bEnablePgm = TRUE;
UpdateData(FALSE);
and if there are compilation errors, fix them, go line by line and compare; in the visual studio IDE you can double-click on an error line in the output window and it will go to the line in the editor.
If you think there are no errors in the .cpp file, check the .h file; and don't give up so easily.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
This is fair enough, but I am only going off a book which fails to tell users that they will get 27 errors.
Whoever wrote the book "gave up" it seems.
Glad I didnt have to pay for the book or program, I will try borland.
Thanks for all your help with this, I dont know how you keep your sanity doing this
Not going off the guide is one thing but I am lost now, totally lost.
|
|
|
|
|
RicD33 wrote:
Glad I didnt have to pay for the book or program, I will try borland.
you will still fail if you don't take the time to learn how to fix compilation errors.
RicD33 wrote:
but I am only going off a book which fails to tell users that they will get 27 errors.
who said the errors were in the book; check again, post the 27 errors, or the first few and the relevant code lines, we could help.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
From the looks of it, the variables weren't declared within the class. If you're not using ClassWizard to generate the handlers, then you may want to check for the following them in the header file.
Inside the class definition, make sure there are declarations for five variables, something like the following:
CString m_strMessage;
BOOL m_bShowMsg;
BOOL m_bShowPgm;
BOOL m_bEnableMessage;
BOOL m_bEnablePgm;
Honestly, C++ isn't a good "trainer" language. Have you programmed in any other languages before?
Bob Ciora
|
|
|
|
|
27 errors doesn't mean that you have made 27 errors, it means that the compiler found 27 erros, but some errors are caused by only one (other) error. It could be that if you change 1 character most errors are already solved...
good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Thanks for all the help, being a beginner, I have only done a little HTML coding and tiny bit of Java.
I know that of all the languages to learn first, C++ is not a good choice! Its very complicated I know but this is whay I want to learn it.
"in the visual studio IDE you can double-click on an error line in the output window and it will go to the line in the editor."
I didnt know this, and this info is greatly appreciated, it will halp a lot to find these errors.
I thought myself it probably is like a "domino effect" with probably a few errors triggering off many others.
What I dont like about Visual C++ is that it refuses to compile if there ar errors. You should have the option still to build it as another name or something, just so you could maybe work out whats wrong by using the program you compiled to see what happens (or does not happen which would be more like it!)
I always say im giving up but I never do! I moan a lot when it goes wrong so quickly into this book but heh, IMHO the very best way to learn something is to fail at it! Sound silly but you "learn" better, because you feel bad failing and dont wanna feel bad again and it sort of makes you snap. If you went through life never failing I am sure your brain would turn to mush (senile) early on in life!
Still not tried my code with BOOL in front. I did use the class wizard to put the function names on my buttons, name the buttons etc, so I guess this BOOL isnt needed?
Still not tried it the other way, its posted here leaving a line out, will try this in a minute.
Anyone wanting to see my code - its in my older posts here, the one with 27 errors and no warnings (and me moaning a lot!).
|
|
|
|
|
Honestly, I don't think these kind of books are good for learning C++. They will learn you how to use the MFC and class Wizard and things like that (in fact how to work with the Visual C++ IDE). It should be named 'Learn to use MFC in 21 days' instead of 'Learn C++'.
But in fact this is not a good way to learn C++. For me, I think the best method is working simply with console applications to learn really the basics of C++ (the syntax, the rules, classes, ...). And once you are familiar with the language (which is not so easy and doesn't come in 21 days), it will be easier to understand the MFC architecture. Sorry, I don't know of a good book to recommend you but I think there are some 'classes' for that on the web.
But it depends also of your purpose: if you want just to make quick and simple applications then it's ok but I think for that you can use VB (eeeek ).
|
|
|
|
|
RicD33 wrote:
you will get errors sooner or later
Everyone gets errors now and then.
RicD33 wrote:
This is the code from the book, copied exactly
Oh? Is that the entire file? Or just the part the book said to add to the existing code?
RicD33 wrote:
I know its adding these 5 variable functions to the boxes and list box that is making these 3 errors, because I can build the program just before doing this and it is fine.
Ah ha! You can build and run the project before adding in the code in InitDialog? If so, did you define the variables in the .h file?
Artificial intelligence is no match for natural
stupidity.
|
|
|
|
|
Yep :P
The .h file:
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Day2REDO.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_DAY2REDO_DIALOG 102
#define IDR_MAINFRAME 128
#define IDC_MSG 1001
#define IDC_SHWMSG 1002
#define IDC_DFLTMSG 1003
#define IDC_CLRMSG 1004
#define IDC_PROGTORUN 1005
#define IDC_RUNPGM 1006
#define IDC_CKENBLMSG 1007
#define IDC_CKENBLPGM 1008
#define IDC_CKSHWMSG 1009
#define IDC_CKSHWPGM 1010
#define IDC_EXIT 1011
#define IDC_STATICMSG 1012
#define IDC_STATICPGM 1013
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1014
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
|
|
|
|
|
RicD33 wrote:
The .h file:
Okay.... that appears to be your resource.h file. That defines numerical constants for the controls and such.
Would you like to zip your project up and send it to me and I will see if I can help you out?
Artificial intelligence is no match for natural
stupidity.
|
|
|
|
|
Thats a kind request! I now have 25 errors. Here are the errors...
13 of these errors are the same type of synxax error - missing semicolon ; before "do/if/}/while" so I have left these errors out...
'm_bEnableMessage' : Undeclared Identifier
CODE = " m_bEnableMessage = TRUE;)"
Missing function header (old style format list?)
CODE = " ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);" (this error is here three times in different places)
'GetSystemMenu' : Function does not take 1 parameters
CODE = " CMenu* pSysMenu = GetSystemMenu(FALSE);"
'm_hlcon' : Undeclered identifier
CODE = " CMenu* pSysMenu = GetSystemMenu(FALSE);"
'Setlcon' : missing storage-class or type specifiers (this error is here twice)
too many initializers
'Seticon' : redefinition;multiple initialization
CODE = " SetIcon(m_hIcon, FALSE); // Set small icon"
it is to do with the initial instructions, like "show a message in the edit box" and these things are not working.
I can send a zip file of this whole thing but I am running late for work at the moment and so I will send this tonight, thanks for helping.
|
|
|
|
|
A thought on adobe.. there is an icon up at the top that you can use to select text rather than using the hand. If this pdf file is a legit file & not an illegal copy you can copy the text. If it's an illegal version that was scanned out of a book, you are on your own. Go buy the book and support the process that brought it to the rest of us who have had to learn from it. Also, direct copy/paste of their code is generally not going to yield working code. Read up on what you are doing first.
|
|
|
|
|
is it possible to post a message which will be delayed for a fixed time - similar to SetTimer(), but the message is sent only for once?
thx
includeh10
|
|
|
|
|
includeh10 wrote:
similar to SetTimer(), but the message is sent only for once?
For this part, you can call KillTimer and specify the ID of your timer. So the timer will be fired only once.
|
|
|
|
|
Hello,
Why cann't you use the SetTimer and OnTimer routiens to achive the same??
rgrds,
Adi
|
|
|
|
|
I have an ActiveX control CPeopleCtrl.
CPeopleCtrl contains method CHuman * GetHuman(BOOL manWomen) that export a male or a women.
How can I add an external method or property for this class method?
I don't know how to expose CHuman...
I'm using VC 6.0
Thanks in advance
|
|
|
|
|
An example is DataGrid control activex from microsoft. The control has a method or property GetColumns which return an reference to CColumns. How Microsoft do that? CColumns is not a control... I don't know what is it...
|
|
|
|
|
|
I created DIALOG with picture, but when I call it in MainFrm using GetDlgItem and than ShowWindow, it's still not works.
|
|
|
|
|
Hi I need some help with global variables in MFC.
How can I have variables accesible form both MyApp.cpp and MyAppDlg.cpp in a dialog based application?
I tried singletons but they don't seem to work...What could be the problem?
Can anyone post a different solution to my problem?
Thx
Muad-Dib
|
|
|
|
|
I guess it should help you:
1. define extern variable and call for it
2. ::AfxGetMainWnd() - define needed type for a value this function return, than return a variable you need.
|
|
|
|
|
Hold the variables in MyApp.h private section, also add public accessor functions for the variables.
I suggest you use the variables through the accessors within MyApp class in order to maintain consistency with accessing through other classes.
Within the MyAppDialog you can access these functions like so:
MyApp* pApp = reinterpret_cast<MyApp*>(AfxGetApp());
ASSERT(pApp != NULL);
var = pApp->GetVariable();
where
GetVariable is the accessor function that you want.
var is of the type that GetVariable returns.
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)
|
|
|
|
|
I actually tried this one only without reinterpret cast and I got assertion failures....
I'll try it again.
Thank you very much.
Muad-Dib
mailto:adamo_piar@freemail.hu
Made in Hungary
|
|
|
|
|
Hmmm it doesn't return the correct values...
Too bad... it actually solved the assertion failures...
Muad-Dib
|
|
|
|
|
Muad-Dib wrote:
it doesn't return the correct values
How is this possible (what have you done in order to determine that the values are incorrect? How have you written the accessor and how is the variable defined?
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)
|
|
|
|