|
hello, I have my code written in visual c++ 2005 and I want to save my results in xml how can I do this?...can you give me a clue? ...please..thanks
lavi
|
|
|
|
|
There are several articles here on CP on how to do this. I have used this one myself.
|
|
|
|
|
I have a display that simulates a digital scope. In my OnDraw rutine I draw the scope with scales and grid lines. I receive data via Ethernet and plot it in the scope. I'm using double buffering to minimized the flicker, though I'm pretty sure I'm not implementing it correctly.
Is there any way to save my memory bitmap or the memory DC so that I can Bit Blit it, when there is no data change, instead of redrawing everything again and then blitting it?
Also, if anyone can point me in the direction on some good articles that talk about double buffering I would greatly appreciate it.
Thanks,
Paul
|
|
|
|
|
masnu wrote: Is there any way to save my memory bitmap or the memory DC so that I can Bit Blit it
Yes.
masnu wrote: if anyone can point me in the direction on some good articles
Take a look here.
|
|
|
|
|
from
http://www.codeproject.com/printing/printingmadeeasy.asp
Error C2660: 'MyPrintUnit::MyPrintUnit' : function does not take 1 parameters
I basically added the 4 files from his zip archive, and then copied and pasted his example usage into his source files, but am getting this error. It looks like MyPrintUnit is derived from GPrintUnit and its this base class that has the 1 parameter constructor, but have I done something wrong, or is it his mistake, or is there a way for me to call the base class version of MyPrintUnit in GPrintUnit
void MyPrintJob::OnPrint()
{
MyPrintUnit unit(this);
unit.Print();
}
note:
class MyPrintUnit : public GPrintUnit
{
public:
MyPrintUnit() {;}
virtual ~MyPrintUnit() {;}
virtual void DefineColHeadings();
virtual void CreatePrintFonts();
void InitPrintMetrics();
virtual BOOL Print();
CFont m_fontHeading;
CFont m_fontBody;
CFont m_fontHeader;
CFont m_fontFooter;
};
class GPrintUnit : public CObject
{
public:
GPrintUnit(GPrintJob *pJob=NULL);
....
etc
|
|
|
|
|
ldsdbomber wrote: Error C2660: 'MyPrintUnit::MyPrintUnit' : function does not take 1 parameters
The compiler is telling you the exact problem. You are constructing a MyPrintUnit object with one argument when it is expecting none.
"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
|
|
|
|
|
yes, I understand that, I think I said that in the original post. What i don't understand is why. I assume as it's an article on the website it's been compiled and working on someone's PC. It looks like it's trying to construct with the base class constructor.
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
Are you saying that this article is broken (the follow up replies don't seem to indicate this) or am I doing something wrong?
|
|
|
|
|
ldsdbomber wrote: Are you saying that this article is broken
In one word, yes.
The sample code is just that - I don't think it was ever compiled. There are obvious errors in it, not even counting the one you stumbled on. Here's the deal: If you look at the unit_table1.h file, you will see that the ctor is defined as
Table1Unit(GPrintJob *pJob);
That is what you must do.
Please post again if you have further questions.
|
|
|
|
|
Thanks,
sorry I didn't realise the articles here hadn't been vetted, I'll be careful in future!
|
|
|
|
|
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
|
|
|
|