|
Here is a *fun* problem:
How do you prototype a derived class?
To add some code to the situation:
This is what I want to do:
namespace ManagedConsoleXPControls
{
public __gc __abstract class ConsoleControlBase : public CollectionBase;
}
However, good 'ol VS 2003 gives me a nasty error:
c:\Projects\Windows Forms\Managed Console\MC - Console XP\MCXP-Prototypes.h(20): error C2143: syntax error : missing ',' before ';'
I'm quite certain that this error pertains to this single line in the code.
Does anyone have any bright ideas?
|
|
|
|
|
There is no such thing as a prototype, but there is a forward declaration, which basically tells the compiler "this symbol is the name of a class that I'll define later".
namespace blah
{
class ConsoleControlBase;
}
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
So be it, forward declaration.
Yet, I still need to declare the class as being derived from another class. This is necessary because I must call functions specific to its base class before I formally declare it.
|
|
|
|
|
The forward declaration should work! Why can't you just declare the class before those functions are called?
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Hi,
I am trying to catch a user exception. The user presses two buttons. But the second button should only be pressed if the first one has else i should warn the user of an incorrect action.
any ideas>
kash
|
|
|
|
|
Hmmmm, I wouldn't consider that an "exception" per se...
I see an "exception" as an error that occurs programatically, like a FileNotFound or the like.
This is more of a UI issue.
Anyway, I would simply set a bool value somewhere in your code, inside the Form class if you are using Windows Forms for example. Upon program initialization, set the bool to false. Everytime the user presses the first button, set the bool to true. When the user presses the second button, check whether the bool is true. If it isnt, show the user a MessageBox or echo the error somewhere where the user is gonna see it.
Hope this helps.
|
|
|
|
|
|
Kash wrote:
But the second button should only be pressed if the first one has
Then disable the second button until after the user pressed the first.
John
|
|
|
|
|
John D. has provided you with the correct solution. If a control is not supposed to be interacted with until a certain condition exists, then disable the control, period.
Don't clutter your code with variables that just makes maintenance harder. It sounds great now, but you must always consider the code in the future.
|
|
|
|
|
Suppose i want users to see all the code i've written for my project. I want to show them the dialogs, but i dont know what file they're stored in.
so, in addition to all the .h and .cpp files, what else should i include for users to download?
*.*
cin >> knowledge;
|
|
|
|
|
.rc and resource.h for dialogs
and probably the contents of the res folder (icons, bitmaps etc)
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
".RC" has the dialog info.
Why don't you just ship the whole project without the debug and release folders?
|
|
|
|
|
well, i really want to show people specific things, not show them everything. i really want to let users see certain dialog boxes, and certain source code files, but i guess i can't if all teh dialog boxes are stored in one rc file.
*.*
cin >> knowledge;
|
|
|
|
|
i don't know if you're aware of this, but the users can see all your dialogs and resources anyway as long as they have your .exe file. All you have to do is open it as a resource in visualC++6.
|
|
|
|
|
... and that ladies and gentlemen, is one to grow on
|
|
|
|
|
hi,
anyone know the how to stop the JIT debugger for windows app.?
i have a program work fine in a pc w/o VS installed...
but in a VS installed pc, it crashed and popup a message box said that access not read or write memory..
any help?
thanks,
jim
|
|
|
|
|
I wouldn't stop the JIT debugger. Fix your program instead. The debugger will only show a message box if there's an error in the program. The fact that it doesn't get shown on a PC without VS installed doesn't mean that there is no error. It just means that it's an undetected error.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I agree with Ryan. Just because it does not show the error does not mean it is working properly. Debug the application to figure out what is causing the problem.
John
|
|
|
|
|
my problem is even i started the project to debug it in debug mode. the program just still crash and lead me to the assembly code rather the C code normally i due with. do u know what the problem lead to this?
|
|
|
|
|
No I am sorry I don't know what causes this.
John
|
|
|
|
|
The program is leading you to the assembly code because it is crashing in one of the windows dlls. However, this doesn't mean that this is a windows bug. This is entirely your fault because you have errors in your program. The errors are being propagated in one of the dlls and that's where the program crashes. You have to find the source of the error, and there are millions of reasons why your program is crashing. No one can help you without you posting some code (the relevant parts, that you believe are causing the crash).
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
thanks.... understand!
let me check.
|
|
|
|
|
Hello, I need to debug my application and it becomes really tricky. It seems that an instruction write somewhere in memory and that this memory is used to store other data. I would like to know if it's possible to use a breakpoint or something like that, that will stop the program at the instruction where this memory is changed ?
Thanks
|
|
|
|
|
Yes, you can set conditional breakpoints.
|
|
|
|
|
Yes I know but I cannot use a variable because this is really to complicated (it's things with void pointers that are being cast and stored in a list...). So I cannot set a breakpoint whan a VARIABLE is changing but when a MEMORY BLOCK is changing !
Any ides?
|
|
|
|