What are you trying to do ?
You cannot access a function from a class without having an instance of this class unless this is a static method. I think you'll need some deeper knowledge of the way to work with classes in C++. Remember that the MFC generated classes (the view, the main frame, the document, ...) are still classes.
i have SDI application that divided to two windows with an instance of CSplitterWnd, so the upper and the lower window thier content need to be printed separately from each other, i put a function in the mainfrm.cpp that calls OnFilePrint (), but OnFilePrint () is a protected function of CView, i tried to make mainfrm class a friend of CEditView but it did not work.
You could simply add a public member function in your CView-derived class which simply calls OnFilePrint.
I don't know if you are allowed to call OnFilePrint (I don't have a lot of experience with printing), but if you can then that's probably the easiest.
I have been set this assignment and i just dont know how to start it or even think how to do it i was wondering if anyone could shed some light on it for me?.
The program is required to store information on a variable number of members of staff in a company. It will use 6 vectors to record the following information.
Staff Number - a 3 digit number in the range 100- 999.
Basic pay rate
Overtime pay rate
Day of birth
Month of birth
Year of birth
For example, if there were 7 staff members the vectors could look as follows:-
staff number 211 302 511 123 145 303 476
basic pay 7.50 7.50 9.00 7.50 8.00 9.00 12.00
OT pay 10.00 10.00 13.00 10.00 12.00 13.00 18.00
day of birth 12 15 25 27 9 6 1
month of birth 8 9 12 10 12 1 1
year of birth 1990 1990 1983 1987 1985 1980 1976
The program should allow the user to specify the number of staff and then enter the data. Once the data have been entered the user should be presented with the following text menu.
1. Print staff details
If the user selects option 1 they should be asked for the staff number (e.g. 511 in the example above). It will be necessary to find the staff number in the first vector and then print out the following information.
Age should be calculated by using a function, it will be necessary to ask the user to input today’s date. You will need to decide whether to ask for today’s date in the main program and pass it to the function or to ask for it within the function.
After the information has been displayed the menu should be displayed again and this process repeated until the user chooses option 2.
To gain additional marks the menu should be modified as follows:-
1. Print staff details
2. Add member of staff
Option 2 should now give the user the opportunity of adding an additional member of staff.
To further clarify what Cedric said, you first get a device context, select the font you be using into it and then all GetTextExtent(). (This may sound obvious to experienced developers, but the failure to select the font is a common mistake.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
The line: lpbi->bmiHeader.biHeight = -240; indicates, by the used of a negative value, that this is a top-down bitmap. That is 0,0 is at the top-left corner. You say you'd tried to "pass negative values to bitmap header", did you mean by altering the sign of this? If this is the case when you then say "no luck" do you mean the video did'nt change from top-down to bottom-up or the text stayed displayed as: "some kind of bottom-up?
I have come across 'fixes' to get bitmaps/video displayed 'the right way up' in the past. These only tend to come to light when further work is done. Are yuu sure there is'nt such a fix somewhere you are not looking?