|
The problem is that the listing of the sample code in the article was never compiled, although the demo code (in the zip download) obviously was.
|
|
|
|
|
ldsdbomber wrote: If I take out the "this" and construct without parameters then the next line unit.Print(); does not work
error C2228: left of '.Print' must have class/struct/union type
Then you've got something else wrong, or have made a change elsewhere that you've not shown. The MyPrintUnit object can be constructed with no arguments.
I put the following in an existing project and it compiled fine:
#include "gfx_printunit.h"
class MyPrintUnit : public GPrintUnit
{
public:
MyPrintUnit() {;}
virtual ~MyPrintUnit() {;}
virtual void DefineColHeadings(){}
virtual void CreatePrintFonts(){}
void InitPrintMetrics() {}
virtual BOOL Print(){return 1;}
CFont m_fontHeading;
CFont m_fontBody;
CFont m_fontHeader;
CFont m_fontFooter;
};
...
MyPrintUnit unit;
unit.Print();
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I download some article about shell programming and try to run it.
After that it always run although I restart my PC and can't delete this DLL files too.
Please give me some idea for solve this problem.
|
|
|
|
|
Read the article. The DLL is probably registered with COM, so unregister it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
That mean can't stop it, right?
|
|
|
|
|
Shell extension are used by shell, so if it is registered, then you need to unregister it.
Prasad
MS MVP - VC++
|
|
|
|
|
Hi
Does anyone know how to do exception handling in constructor?
|
|
|
|
|
try and catch block aren't enough for you?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi
Make the constructors private, then create a static member function called InitYourObject().
CYourClass * CYourClass::InitYourObject()<br />
{<br />
try<br />
{<br />
CYourClass *object = new CYourClass;<br />
return object;<br />
}<br />
catch(...)<br />
{<br />
return NULL;
}<br />
}
To create an object call
CYourClass *myObject = CYourClass::InitObject();
Hope it helps
Regards
The Best Religion is Science.
Once you understand it, you will know God.
|
|
|
|
|
I avoid putting error handing in the constructor (short of the occasional ASSERT). The constructor is for constructing. If there's a possibility of bad/invalid data, you should either allow the construction to happen and set appropriate conditions in the object to indicate invalid data, or you should validate data BEFORE construction so you can assume that everything is okay at the time of construction. I feel it makes the code much more maintainable (with appropriate and copious code comments of course).
Of course, this is just the way I do it and I'm sure others will want to argue their own approach. You guys have fun with that.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
I want to implement a username/password authentication system in my MFC/VC++6 application. the idea is to have username/password pairs and previlige level of the user stored encrypted in a file and while authenticating a user get, decrypt and match the info and set previlige level. Plz have any code?
Thanks in advance.
sohail
|
|
|
|
|
How secure does it have to be ? MD5 code is easy to find on the web, you can store MD5 hashes of usernames and passwords, and apply the hash to what the user types in ( rather than have to unencrypt the records in your text file ). This has the advantage that a hash that cannot be reversed is more secure, so long as the hacker doesn't know what the algorithm is.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi,
I'm completely agree. It is the encryption for CISCO Routers for admin or to connect in remote rooters and create a WAN-Path (At least two years ago when I made the CCNAs). You can not uncrypt (at least not very easy) but you can always apply the encryption to whatever the user types and compare both encrypted logins or passwords
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
You may use Crypto API , see here [^] for a code sample.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
i want code for a editor which is looks like a c editor.
plz send the code. the code is must and should in vc++ only
|
|
|
|
|
|
ROTFL - that's brilliant.
This site is for asking people to help you, not to make random requests for people to send you complete projects.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
google
"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
Does anyone know what is the use of having the member function of the = operator has private?
eg Class A
{
A& operator=(const A& a);
public:
void display()
}
what is the use of having A& operator=(const A& a)function has private ?
|
|
|
|
|
To prevent people from using it. For example, if you have a very complex object, or are just too lazy to implement a copy constructor and assignment operator.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hi
Do you know how to do exception handling in constructor?
|
|
|
|
|
Yes, I know how to do both catching exceptions in the constructor, and catching them from the calling code that is invoking the constructor.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
... and where is your smile?
--
=====
Arman
|
|
|
|
|
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|