|
Use accelerator table - same as for menu and toolbar.
Best wishes,
Hans
|
|
|
|
|
Dear All,
I'm designing a tool which can open a document and print out that document to default printer.
My tool can only print out text file, I want it can be integrate other document files.
Can you tell me how to do so, and where can I refer to?
I'm using Visual Studio V6.0 and Program language C/C++, MFC
|
|
|
|
|
KienNT78 wrote: I'm designing a tool which can open a document
Are you talking about a Word document? If so, this is a proprietary format, and the only way to print it is by using Word automation.
If the choice of document format is up to you, then you could use rich-text format (RTF) documents, and use the CRichEditCtrl control.
Best wishes,
Hans
|
|
|
|
|
|
Why the operator overloading function is normally a non-member with friend access?
Why its not a member fuction itself?
KIRAN PINJARLA
|
|
|
|
|
Overloading an operator as a nonmember gives you automatic type conversion on all arguments.
But when you overload a binary operator as a member, the two arguments are no longer symmetric - automatic type conversion applies to the second arg only.
The drawback to using nonmember overloading is that it may be less efficient - member overloading allows you to bypass get/set functions and directly access class data members.
Most texts will have examples.
Best wishes,
Hans
|
|
|
|
|
Thank you so much for your reply.
Hans Dietrich wrote: the two arguments are no longer symmetric - automatic type conversion applies to the second arg only.
I request you to explain what exactly these lines mean? If possible with code.
Thank you.
KIRAN PINJARLA
|
|
|
|
|
Consider a class for Complex numbers, which has an addition operator defined as a member:
class Complex
{
public:
Complex(double re, double im = 0);
Complex operator+(const Complex& rhs);
private:
double re, im;
};
We would like to be able to write code like this:
Complex c1(1,1);
Complex c2 = c1 + 4.5;
Complex c3 = 10 + c1;
The first statement simply constructs the complex number c1 = 1 + 1i. The complex number c2 is obtained by adding 4.5 to c1. Writing the assignment in functional form yields:
c2.operator= ( c1.operator+ ( 4.5 ) ); The addition operator takes a Complex argument. So how does this work when a real number, 4.5, is passed as the argument to operator+? It turns out that the compiler uses the constructor to implicitly convert 4.5 into a Complex by creating a temporary variable in order to perform the addition:
Complex c1 (1,1);
{
Complex t1 (4.5);
Complex c2 = c1 + t1;
}
The braces are used to show the scope of the temporary t1 which only exists for the duration of the addition. In functional form this can be written:
c2.operator= ( c1.operator+ ( t1 ) );
Next consider the assignment of c3. In functional form, the statement is written:
c3.operator= ((10.0).operator+ ( c1 ));
In order for this to work, 10.0 must be converted to a Complex. However, the compiler will not implicitly convert the left operand to call a member function on it.
If the addition operator is implemented as a non-member:
Complex operator+ (const Complex& a,
const Complex& b);
the compiler will implicitly convert both arguments as needed so that the assignment of c3 will compile. The operator may or may not be a friend depending on how it is implemented.
Implicit conversions are also used for conversion of initializers, function arguments, function return values, expression operands, expressions controlling iteration and selection statements, and explicit type conversions.
Implicit conversions (for left operands) will be performed implicitly by the compiler when the operator is a non-member. If type conversions are undesirable, the operator should be implemented as a member function. Most binary operators, such as addition, should be implemented as non-members since implicit type conversions are desired.
For more details, please consult C++ reference book.
Best wishes,
Hans
|
|
|
|
|
I am very very thankful to you.
Wish you all the best.
KIRAN PINJARLA
|
|
|
|
|
Hi!
I need a Dissasembler source code, example or article
please help me
Zo.Naderi-Iran
|
|
|
|
|
Here you go.
Best wishes,
Hans
|
|
|
|
|
Thank you!
has this source code an article to explain it?
Zo.Naderi-Iran
|
|
|
|
|
Hi.
Anyone have any idea of how or what to use to plot a 3D curve in real-time?
I want the 3D curve to be drawn on the canvas in real time so that we are able to see the curve being drawn at which ever direction.
I have tried to plot the 3D curve using openGL and gnuplot but that is not in real-time.
Thanks!
|
|
|
|
|
Here is a sample of 3D function plotting.
Best wishes,
Hans
|
|
|
|
|
Hi
All
I am using VC++ 6.0 for my project in which i want to change size of DialogBox at runtime.So if anybody have solution to this then plz forward me.
Thanks and Regards
Atul
atul
|
|
|
|
|
From your code - use MoveWindow() or SetWindowPos(). or Do you want to allow the user to drag the dialog from it's corners and resize it?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi
i use this function in onPaint() funtion in
switch()
{
CDialog* dlg = (CDialog*)GetDlgItem(IDD_DIALOG_NSMESSAGE);
HWND hwnd = dlg->GetSafeHwnd();
SetWindowPos(hwnd,50,50,50,50,SWP_SHOWWINDOW) ;
}
but it does'nt work. Is it a right way or i have to do it by some othere way.
Regards
Atul
|
|
|
|
|
M. Atul wrote: . Is it a right way
It is not.
You must understand cases, whenever OnPaint is called. That is not place to change size of window.
Prasad
MS MVP - VC++
|
|
|
|
|
M. Atul wrote: I am using VC++ 6.0 for my project in which i want to change size of DialogBox at runtime.So if anybody have solution to this then plz forward me.
If you just want to change the size call...
CSize csSize( nNewWidth, nNewHeight );
SetWindowPos( 0, 0, 0, csSize.cx, csSize.cy, <code>SWP_NOMOVE</code> | SWP_NOZORDER | SWP_FRAMECHANGED );
|
|
|
|
|
M. Atul wrote: Hi
All
I am using VC++ 6.0 for my project in which i want to change size of DialogBox at runtime.So if anybody have solution to this then plz forward me.
where you want to change the size of your dialog box!
"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
|
|
|
|
|
i don't know why the some strange extra table name appear in thelist control:
CListCtrl m_table;
CDaoDatabase db;
db.Open("D:\\ktt.mdb");
short n_table=db.GetTableDefCount( );
CDaoTableDefInfo TableInfo;
for( int i=0; i
|
|
|
|
|
Hello,
I have a CString in a CDialog and I want to print it in a Network printer.
I have been taking a look of the diffrent methods to do it but in all of them I have find problems,
For example:
1.-
filebuf fb( "prn:" );
filebuf fb( "prn:" );
cout = &fb;
cout << "testing";
Can only print to local printer.
2.- CView::OnPrint
I can't use it because I am using CDialog not Cview, CFormView.....
Fixing:
Does any way to print a CString using CPrintDialog?
Thanks in advance,
Best regards
|
|
|
|
|
QPrint may be what you are looking for.
Best wishes,
Hans
|
|
|
|
|
|
Thank you this is what I was looking for,
It is really easy to use.
Regards
|
|
|
|