|
Thanks for the information and your offer to zip and send me the code.
I will look into the Q article, as well as another possibility.
If I think the zipped code would be useful, I'll send you an email.
Thanks again for the offer.
|
|
|
|
|
Hi, i've got this class
template<class t=""> class pointer
{
private:
T *p;
};
and i get 4 if i do sizeof(pointer).
if i add a static member data, it doesn;t count. why is it that? is it because there's only one copy of that atribute for all the instances of the class?
then, if i add a virtual function (or 2, or 3), i get 8 if i do sizeof(pointer). why is that?
thanks for your help!
|
|
|
|
|
Adding a static member does not affect the size because a static member does not exist in an object (instantiation) of the class. The memory for the static member is allocated in ONE place, not for each object.
The reason that the size increases when you add a virtual method, is that the object needs a pointer to the VTable. This is a table of pointers, one for each virtual method. This table is specific to your class. Each object of the class will contain a pointer to this VTable. The size of this pointer is 4 bytes.
|
|
|
|
|
|
Hi, i would like to know hot to implement an operator to cast a class to void*.
I thought of overloading operator (), but i don't know how to proceed (as i didn't find anything on the web). Any ideas?
thanks!!
|
|
|
|
|
The following example overloads the + operator to add two complex numbers and returns the result.
// operator_overloading.cpp
// compile with: /EHsc
#include <iostream>
using namespace std;
class Complex
{
public:
Complex( double r, double i ) : re(r), im(i) {}
Complex operator+( Complex &other );
void Display( ) { cout << re << ", " << im << endl; }
private:
double re, im;
};
// Operator overloaded using a member function
Complex Complex::operator+( Complex &other )
{
return Complex( re + other.re, im + other.im );
}
int main()
{
Complex a = Complex( 1.2, 3.4 );
Complex b = Complex( 5.6, 7.8 );
Complex c = Complex( 0.0, 0.0 );
c = a + b;
c.Display();
}
|
|
|
|
|
Something like:
class MyClass
{
public:
operator LPVOID() const
{
return ???;
}
};
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
what do you mean with ???
thanks!
|
|
|
|
|
Since you did not tell us anything about your class, I obviously don't know what that method needs to return.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hi ,
I want to change the toolbar at click of a button .I am new to vc++ and i dont know how to solve this task.Any help would be much appreciated . thanks in advance .
regards,
vinod
|
|
|
|
|
Here is a partial clip for switching toolbars, from "The MFC Answer Book":
UINT nIDFrom = ::GetWindowLong( pBarFrom->GetSafeHwnd(), GWL_ID );
UINT nIDTo = ::GetWindowLong( pBarTo->GetSafeHwnd(), GWL_ID );
::SetWindowLong( pBarFrom->GetSafeHwnd(), GWL_ID, nIDTo );
::SetWindowLong( pBarTo->GetSafeHwnd(), GWL_ID, nIDFrom );
pFrame->ShowControlBar( pBarFrom, FALSE, bDelay );
pFrame->ShowControlBar( pBarTo, bVisible, bDelay );
This example is used to switch between toolbars that only differ in the size of the buttons. It could also be used to switch between a toolbar that contains image buttons and one that uses test buttons instead.
I hope that helps!
INTP
|
|
|
|
|
i use IMsTscAx control to connect to the TS Server.
setting valid server name and so on i finnaly call connect method. he return s_ok. but exploring other property's values i find that startconnected property is false - thats mean that control is not trying to connect. as a sequel connected property is false too.
what do i do wrong?
regards
|
|
|
|
|
Can anyone tell me how to obtain the screen dimensions in an MFC app?
Thanks
|
|
|
|
|
it doesnt seems to be mfc. but its simply call api functions:
GetSystemMetrics(SM_CXSCREEN);
GetSystemMetrics(SM_CYSCREEN);
|
|
|
|
|
|
Get SystemMetrics will do the trick, if you'd like to substract the taskbar of other toolbars => use SystemParametersInfo.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
|
CWnd::GetDesktopWindow()->GetWindowRect (...);
Although this will return the same screen size regardless of the presence of app bars. You probably want the size of the workspace.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
i would like to paste some word text with special characters, őúűöí. my problem is, that they are always converted to simple chars at paste operation, oúuöi.
Is there anyone who can help me out?
Thanks.
Leo.
|
|
|
|
|
Have you used CF_UNICODETEXT as the format when you copied the data into the clipboard?
Jaime
|
|
|
|
|
I paste the text from the MS Word document. The CEdit supports only the CF_TEXT format.
Leo.
|
|
|
|
|
Do somebody know where i can find a word automation example to write a .doc file?
Thanks a lot
tiziacaia
|
|
|
|
|
find your office "compiled help" file. This file has the .chm extension.
Here you can read up about the objects ...
It will not really get you started though.
Search on MSDN and google and idd hope that somebody has a sample code.
good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
MSDN article Q178749 has an Excel example. Step 9 is the important one as you'll use Word's type library instead of Excel's. Creating an instance of the (Word) _Application object and using its methods will be the same, though.
_Application app;
app.CreateDispatch(_T("Word.Application"));
Documents docs = app.GetDocuments();
CString strFilename(_T("A letter to home.doc"));
_Document doc = docs.Open(COleVariant(strFileName), ...);
...
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks a lot for the answers but now i get a new problem:
error C2065: '_Application' : undeclared identifier
I added word's type library, with classes _Application, _Document and Documents. I tryied to import the .h files but don't work.
I don't understand.
Thanks
|
|
|
|