I'm performing printing of reports in an MFC app in what I think is a fairly canonical way...with a CDC and CFormView with OnDraw implemented. CDC's TextOut member functions and so on are called in OnDraw().
I get inconsistent results from printer model to printer model....The margins are different, and sometimes the important parts of my documents are actually cropped. Print preview accurately represents how the document will be (often incorrectly) printed.
Is there some technique that allows me to calculate an offset for the specific model of printer in use on the fly, to compensate when drawing in OnDraw() - perhaps something to do with CDC::GetDeviceCaps()? It seems that the area of the page that my reports are "projected onto" varies somewhat (not terribly, but certainly enough for it to be a problem), but the scale is always correct.
Test(T *a, T *b)
Test t(integerList.begin(), integerList.end());
I get the following error:
error C2660: 'Test::Test' : function does not take 2 arguments
This is an example to show the problem, but my real goal is to have a templated constructor that takes two iterators and uses them to fill an internal collection. I don't want the constructor to depend on the iterator types, i.e. the constructor shouldn't care if the iterators are from a list, vector, or raw pointers to an array.
template <class T>
Test(T a, T b)
Test<std::list<int>::iterator> t(integerList.begin(), integerList.end());
However, it is not what you're looking for, I suppose.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
how do I get each object in the array to do what I want it to do?
How about something like:
ourAnimals = new Goldfish();
ourAnimals = new Crocodile();
ourAnimals = new Elephant();
for (int i = 0; i < 3; i++)
ourAnimals[i]->converse(); // Animal::converse() is virtual
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Not sure I really understood your question: you want all specific Animal do something specific in the converse method ? If that is the case, that is really simple: simply declare the function in the base class (Animal) as a virtual function and override it for each specific animal. Each specific animal can then do something specific.
hi vc++ programmers,
i am doing an aplication in vs-2008 that is being migrated from vs-2003.I have 10 projects in my application.When i am building my application i am getting all my libraries getting created in release mode...
But when it comes to Debug mode for three projects library folders are not getting created...My application is working in the release mode but not in debug mode....
After compilation my linker->command line: is not showing those three libraries included in debug mode...
Why those three library files are not getting created? please show me any remedy!
Thanks in advance...
Hi they are getting created now,,but those three libraries are not getting linked.but they are getting linked in release mode...
I am not getting those three libraries in my linker->commandline even though i have given those libraries from projectsettings->linker->additional dependencies...
A very subtle situation which is a great lesson for the future. Both your read and write loops contain no error checking. However having completed the write processing, a visual check of the output file suggests that the content is correct. The read loop reads sixteen values and prints them out, but does not check that you have read the full values every time. If you take a look at the file produced by this program you will see the hex value 'x1a' at character position 26. This character is taken by the fread() function as signifying no more data, so the last value read in is incomplete which gives the strange value printed by the program. Every subsequent read will fail so the value stored in memory is whatever was there previously; in this case the values that happen to be in the array storage space. The solution is to always check the results of your read and write statements, but in this case you also need to use "wb" and "rb" on your _wfopen statements to ensure the 'x1A' is not taken as end of file.
I want to get the default value of the KEY from the registry
if( RegOpenKeyEx (HKEY_CLASSES_ROOT,
KEY_QUERY_VALUE, &keyHandle) == ERROR_SUCCESS)
"Default value your Windows system is:: %s",
I have created MFC dialog based application using VS 2008 application creation wizard.
In project settings if I use "Use Unicode Character Set" option, I cannot see winXP styles on any of the controls on the dialog,
and If I use "Use Multi-Byte Character Set" option, I can see the winXP styles.
Why this is happening? can't I use "Use Multi-Byte Character Set" option without losing WinXP styles to the control.
Some one please help me out with this issue.
Thanks in advance.
Last Visit: 31-Dec-99 18:00 Last Update: 1-Oct-23 3:35