|
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 derived a class from CView and declared a publich function in it in this function i called OnFilePrint() by an CEdit Object, but i got the same error C2248.
|
|
|
|
|
susanne1 wrote: in this function i called OnFilePrint() by an CEdit Object
I don't understand what you mean... What is this CEdit object doing here ? Please, be specific in your reply, and maybe post some useful code so that we can see what you are doing exactly.
|
|
|
|
|
how to make application for windows mobile. I need all details to build application for windows mobile
Trioum
|
|
|
|
|
For instance, choosing the right forum to post to [^] would be a nice start.
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
[My articles]
|
|
|
|
|
In addition to our pal-lini's link, here's a link to the other world[^]
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Hi poeple,
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
2. Quit
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.
Basic pay
Overtime pay
Age
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
3. Quit
Option 2 should now give the user the opportunity of adding an additional member of staff.
Cheers guys
|
|
|
|
|
Neal beavis wrote: 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
Is this a requirement? I think it would be better using a vector of struct s...
It looks a quite strightforward task, what are your troubles with it?
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
[My articles]
|
|
|
|
|
i genrally dont know how to start this assignment? i dont really know how to use the vectors within this ssignment.
you help would be much appreciated!
|
|
|
|
|
What are you troubles with vectors?
BTW are you talking about std::vector class instances, or do you need the 'on the metal' approach (i.e. C -like arrays)?.
BTW2 using arrays or vectors is really basic stuff, possibly you need to go deeper inside documentation.
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
[My articles]
|
|
|
|
|
the #include <vector>
and mainly i dont know how to include the vector within the project I mean would it be
vector<int> staff number(7);?
then cout<<"Please enter staff number"<<endl;
then cin>>staff number>>endl;
|
|
|
|
|
What about documentation? Here [^] you may find sample code.
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
[My articles]
|
|
|
|
|
A sample vector usage:
#include <vector>
class myClass
{
};
std::vector<int> vecInts;
std::vector<myclass> vecMyClass;
vecInts.push_back(10);
myClass obj;
vecMyClass.push_back(obj);
<pre>
|
|
|
|
|
Neal beavis wrote: 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
Why not something like:
211 7.50 10.00 12 8 1990
302 7.50 10.00 15 9 1990
511 9.00 13.00 25 12 1983
123 7.50 10.00 27 10 1987
145 8.00 12.00 9 12 1985
303 9.00 13.00 6 1 1985
476 12.00 18.00 1 1 1976 This way each "row" could represent one staff member. Your way would work too, but it's not quite as intuitive.
"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
|
|
|
|
|
Hi,
I am new to Win-32 C++. and i want to get the string size (Height and Width) of a string Like ( In VB.Net )
Dim strSize As SizeF
strSize = e.Graphics.MeasureString("Mitesh Khatri", New Font("Sans Serif", 9, FontStyle.Bold))
How i get same thing in Win-32 C++.
Please suggest.
Thanks
~Khatri Mitesh
khatrimitesh@hotmail.com
Bikaner (Rajasthan)
INDIA
|
|
|
|
|
How are you displaying the string ? Using CDC::TextOut ? If yes, then you can use CDC::GetTextExtent[^]
|
|
|
|
|
~Khatri Mitesh~ wrote: I am new to Win-32 C++
I see, then you want to become familiar with this[^]
|
|
|
|
|
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
|
|
|
|
|
Hi everyone
I'm stuck with the code which renders a preview of a Camera using VFW.
The thing is that i want to do TextOut on this image within FrameCallback,
but the textout comes some kind of a bottom-up ?
The idea is to store avi sequence with a text drawn inside (generally a date).
Here is the code:
I enumerate available devices, and connect to the one i choose.
Then i do
BOOL SetVideoFormatRGB()<br />
{<br />
DWORD size = capGetVideoFormatSize(ghWndCap);<br />
<br />
if ( size <= 0 )<br />
{<br />
<br />
return FALSE;<br />
}<br />
<br />
void* pBuffer = new BYTE[size];<br />
BITMAPINFO* pBitmapInfo = (BITMAPINFO*) pBuffer;<br />
<br />
if ( capGetVideoFormat(ghWndCap, pBuffer, size) <= 0 )<br />
{<br />
<br />
return FALSE;<br />
}<br />
<br />
pBitmapInfo->bmiHeader.biBitCount = 24;<br />
pBitmapInfo->bmiHeader.biCompression = 0;<br />
pBitmapInfo->bmiHeader.biSizeImage = pBitmapInfo->bmiHeader.biWidth * pBitmapInfo->bmiHeader.biHeight * 3;<br />
<br />
<br />
if ( ! capSetVideoFormat(ghWndCap, pBitmapInfo, size) )<br />
{<br />
<br />
return FALSE;<br />
}<br />
<br />
<br />
g_nBitCount = pBitmapInfo->bmiHeader.biBitCount;<br />
g_nBitsPerPixel = pBitmapInfo->bmiHeader.biBitCount;<br />
<br />
<br />
return TRUE;<br />
}
Next thing - i create a Callback for VFW:
capSetCallbackOnFrame(ghWndCap, (FARPROC)FrameCallbackProc);
And process each frame :
<br />
LRESULT PASCAL FrameCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr)<br />
{ <br />
<br />
if ( g_nBitCount != 24 )
return 0;<br />
<br />
<br />
if ( ! g_hFrameBitmap )
return 0;<br />
<br />
BeginPaint(hWnd,&ps);<br />
<br />
<br />
<br />
SetBitmapBits(g_hFrameBitmap, g_nImageWidth*g_nImageHeight*3, lpVHdr->lpData);<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
SetBkMode(g_hFrameDC,TRANSPARENT);<br />
SelectObject(g_hFrameDC, FONTmain);<br />
SetTextColor(g_hFrameDC,RGB(0,0,0));<br />
hPen = CreatePen(0, 1, RGB(210,210,210));<br />
SelectObject(g_hFrameDC, hPen);<br />
Rectangle(g_hFrameDC, 0,0, 320,100);<br />
TextOut(g_hFrameDC,2,2,"AAAAAAAAAAA",10);<br />
<br />
GetBitmapBits(g_hFrameBitmap, g_nImageWidth*g_nImageHeight*3, lpVHdr->lpData);<br />
<br />
<br />
<br />
EndPaint(hWnd,&ps); <br />
return (LRESULT)true;<br />
}
This code does the trick but all i draw on g_hFrameBitmap is bottom-up, so point:
0,0 is on the bottom left side of whole image. The string "AAAAA..." also comes
bottom up.
g_hFrameBitmap is created as:
<br />
void CreateGraphicObjects(HWND hWnd)<br />
{<br />
<br />
g_hFrameDC = CreateCompatibleDC(GetDC(hWnd));<br />
<br />
<br />
<br />
<br />
memset(&lpbi, 0, sizeof(lpbi));<br />
lpbi = (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER) + (256 * sizeof(RGBQUAD))];<br />
lpbi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);<br />
lpbi->bmiHeader.biWidth = g_nImageWidth;<br />
lpbi->bmiHeader.biHeight = -240;<br />
lpbi->bmiHeader.biPlanes = 1;<br />
lpbi->bmiHeader.biBitCount = 24;<br />
lpbi->bmiHeader.biCompression = BI_RGB;<br />
lpbi->bmiHeader.biSizeImage = WIDTHBYTES((DWORD)g_nImageWidth * 8) * g_nImageHeight;<br />
lpbi->bmiHeader.biXPelsPerMeter = 0;<br />
lpbi->bmiHeader.biYPelsPerMeter = 0;<br />
lpbi->bmiHeader.biClrUsed = 0;<br />
lpbi->bmiHeader.biClrImportant = 0;<br />
<br />
<br />
<br />
g_hFrameBitmap= CreateDIBSection( <br />
NULL,
lpbi,
DIB_RGB_COLORS,
(void **)&pBits,
NULL, <br />
0 ); <br />
<br />
<br />
delete[] lpbi;<br />
SelectObject(g_hFrameDC, (HBITMAP)g_hFrameBitmap);<br />
<br />
<br />
}<br />
Any chance to get this resolved? I've tried to pass negative values to bitmap header - no luck.
Best reagards!
|
|
|
|
|
Hi,
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?
|
|
|
|
|
Hi again,
On browsing through some of my code I came across:
int OldMode = ::SetMapMode(hCrossesDC, MM_TEXT); Could this be what you need?
|
|
|
|
|
Jonathan,
yes i have altered the
lpbi->bmiHeader.biHeight = -240;
to +240 and -240 - but this does not make any change.
The TextOut 0,0 position is at bottom left side of the video preview and the letters
are drawn bottom-up.
I will look at your above code later on to see if this sorts this out.
Many thanks for your reply!
|
|
|
|
|
Damn still nothing.
Have a look at this screen below:
http://www.fileden.com/files/2009/3/19/2370332/image.jpg
After applying SetMapMode(g_hFrameDC, MM_TEXT); - still the same issue.
Look at the TEXTOUT - it is rendered as:
TextOut(g_hFrameDC,2,2,"AAAAAAAAAAA",10);
And comes bottom-up in the wrong coordinates... ://
|
|
|
|
|
Still noone?
So how do they do that in other capture video programs?
It is just a matter of adding a Label to the video stream and it is such a pain?
Damn ;/
|
|
|
|