|
amit10i wrote: I am making a dialog based application , i want to disable the maximize button...
Disable or remove?
amit10i wrote: ...when i disable the maximize button from resources check box for maximize button , gui window hides the task bar of windows...
Are you referring to the dialog's title bar?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
|
|
|
|
|
yes i am referring to dialog's title bar,
either disable or remove , anything will suffice , preferably removing the maximize button ,
|
|
|
|
|
amit10i wrote: preferably removing the maximize button ,
How about removing the WS_MAXIMIZEBOX style?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
|
|
|
|
|
I am working on Excel automation using VC++(unmanaged).
Following are the two issues:
1. Whenever Excel is closed , Excel.EXE is not getting closed.
My application should track opening and closing of Excel.
I released application pointer(Excel::_ApplicationPtr) but same problem.
I googled and got few solutions, but nothing worked.
I tried :
Excel::_ApplicationPtr XL.
XL->Quit();
XL->Release();
XL = NULL;
but none of these worked.
2. Is there any callback which tracks excel.exe is closed?
Please give me clue to solve these issues.
Regards,
KTTransfer.
|
|
|
|
|
Just try this - Set the 'Visible' property to TRUE and then call Quit method.
-- Its a guess, if not worked, you may have to find the EXCEL process and terminate the process using TerminateProcess function.
|
|
|
|
|
Are you calling GC.Collect()?
|
|
|
|
|
It must have something to do with the way you are accessing Excel's type library. I've got several Excel automation projects that close Excel just fine. The only difference is that they don't use the #import directive. The one that does use #import simply calls app->Quit() .
"One man's wage rise is another man's price increase." - Harold Wilson
"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
|
|
|
|
|
Again see below... I have had this error before. I have code to controls add-in installation to avoid warnings from one xla referencing another.
// The following line is necessary to be sure that app object is released when we finish, because
// the Garbage Collector is non-deterministic and by default can leave app unreleased.
System::GC::Collect();
System::GC::WaitForPendingFinalizers(); //GetActiveObject Error is this line is excluded
|
|
|
|
|
This is managed code. I think the OP is using unmanaged code.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
|
|
|
|
|
Then are you using the following?
//Release the no-longer-needed IUnknown...
if (pUnk)
pUnk->Release();
//... Add your automation code for Excel here ...
//Release pDisp when no longer needed...
if (pDisp)
pDisp->Release();
//Cleanup COM...
CoUninitialize();
|
|
|
|
|
Ted2102 wrote: Then are you using the following?
No, I use smart pointers whenever possible.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
|
|
|
|
|
Then instead of #import what else we can use to include?
I tried making it visible and then used quit but no use.
It's not getting killed.
|
|
|
|
|
Hi to Everyone.
Its been a long time, I have been searching for an clear cut idea of
....shallow copy and deep copy with regards to Copy constructor and assignment operator.
I search the web, but many places has been confused me...I know that the problem comes only when we do use of pointers...But, dont know exact situation and solution for it. when to use which one..ie in which situation to used which one....
Can anyone please help me understanding the concept better.
A good example problem with relating to all these topic would be appreciated.
May be could you please relate the example with the following situations
1. Default copy constructor
2. Default assignment operator
3. overloaded copy constructor
4. overloaded assignment operator
Thanks in advance
-----------------------------
I am a beginner
|
|
|
|
|
There's no difference concerning this behavior between a copy constructor and an assignement operator, so my explanation is valid for both.
The problem with a default constructor is that it simply copies byte by byte all the content of your class. This is ok for most of the cases when your class contains only plain data type for instance.
Now, if you have a class which contains a pointer and then if you copy your class using a shalow copy, both class instances will contain a pointer pointing at the same memory location. If you have a destructor like this:
MyClass::~MyClass()
{
if (myPointer)
{
delete myPointer;
myPointer = NULL;
}
}
Then you will end up in big troubles once one of the class instances gets destroyed because its destructor will be called and you will end up with a pointer pointing to memory which has been release in your other instance.
So, what you have to do instead is allocate a new pointer and copy the content when you copy the class:
MyClass::MyClass(const MyClass& copy)
{
myPointer = new ....;
......
}
|
|
|
|
|
Thanks a lot for your valuable reply
Got some more doubts again.
Cedric Moonen wrote: The problem with a default constructor is that it simply copies byte by byte all the content of your class.
What does the code of default constrictor is...what I mean is what is the code present in the default constructor?
Cedric Moonen wrote: Now, if you have a class which contains a pointer and then if you copy your class using a shalow copy
Could you please elaborate this, what exactly is meant by copying using shallow copy? Does this mean copying with the default copy constructor what we have?
-----------------------------
I am a beginner
|
|
|
|
|
|
hrishiS wrote: What does the code of default constrictor is...what I mean is what is the code present in the default constructor?
If you don't provide any constructor yourself, the default constructor will simply assign all variables, similarly as you would do something like this:
MyClass::MyClass(const MyClass& copy)
{
member1 = copy.member1;
member2 = copy.member2;
....
}
So, it means that if your class contains a pointer, this will result in something like this:
MyClass::MyClass(const MyClass& copy)
{
myPointer = copy.myPointer;
}
And of course this is not nice because both of your instances will have a pointer pointing at the same location and there's no way anymore to know which of the two has ownership of the pointer (so, which one is responsible for deleting it). And if you destroy that pointer in the class destructor, then you end up with the problem I described earlier: one instance will end up with a pointer pointing to memory which has been released (and thus which can contain corrupted data).
Furthermore, you can also encounter another problem than with the one you have when manipulating pointers. If one (or more) member of your class is an object that cannot be copied (because its copy constructor has been made private for instance), then your code won't even compile because there's no way for the default constructor of your class to copy the object (as the copy constructor is private). Thus, the only way to be able to copy your class is to provide a copy constructor that instead of calling the copy constuctor of your member, it will create an new instance of this member and initialize it properly.
hrishiS wrote: Could you please elaborate this, what exactly is meant by copying using shallow copy? Does this mean copying with the default copy constructor what we have?
It is assigning all members from one class to another as I described at the begining of this message.
|
|
|
|
|
Cedric Moonen wrote: If you don't provide any constructor yourself, the default constructor will simply assign all variables,
But the default constructor doesn't have any parameter with it...So in that case to which value the member variable will get initialized to?...
Cedric Moonen wrote: It is assigning all members from one class to another as I described at the begining of this message.
Does it meant that shallow copy is member to member copying of each member variable one by one...?
is it,...Copy Constructor is doing shallow copy?
In that case, if we dont provide an copy constructor does the default copy constructor provides deep copy?
-----------------------------
I am a beginner
|
|
|
|
|
hrishiS wrote: But the default constructor doesn't have any parameter with it...So in that case to which value the member variable will get initialized to?...
We are talking about the default copy constructor here. The default copy constructor receives the object from which to copy.
hrishiS wrote: Does it meant that shallow copy is member to member copying of each member variable one by one...?
is it,...Copy Constructor is doing shallow copy?
Yes, that's what I showed you in my previous reply: a default copy constructor simply assigns all members one by one (in fact, it is using the copy constructor of each member to create them and not the assignement operator, but this is not important in the discussion here). So, in that sense a default copy constructor is doing shallow copy.
hrishiS wrote: In that case, if we dont provide an copy constructor does the default copy constructor provides deep copy?
No, I just said the opposite: a default copy constructor does not make a deep copy. How could it do it ? You are the one how wrote the clas, so you know you have to copy some specific members (like pointers). The compiler doesn't know anything of that, he can simply assign all members from one object to the other. How can he know that for a pointer he has to allocate a new pointer and copy the content of the pointer ?
|
|
|
|
|
I have an MDI application with CHtmlView. In CInvoiceHtmlView::OnBeforeNavigate2(...)I see if a special button is pressed. When is pressed , I would like to close child frame , but I don't know where I do that ...
Here is my trials :
<br />
void CInvoiceHtmlView::OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel) <br />
{<br />
<br />
if(m_bProcessNavigate)
{<br />
CString sBytes;<br />
<br />
if(baPostedData.GetSize())<br />
{<br />
for(int i = 0;i < baPostedData.GetSize();i++)sBytes += (char)baPostedData[i];<br />
}<br />
<br />
sBytes = sBytes.Left(7);<br />
if(sBytes == "button2")m_bClose = TRUE;<br />
}<br />
<br />
CHtmlView::OnBeforeNavigate2(lpszURL, nFlags, lpszTargetFrameName, baPostedData, lpszHeaders, pbCancel);<br />
}<br />
now : m_bClose show me if special button was fired , but I don't know how can I use this to close child window ...
modified on Friday, December 4, 2009 4:51 AM
|
|
|
|
|
as we know, we can share the same memory in multi-processes through dll-library. if i use stl container as the public accessing memory in multi-processes, does it could do effect, thanks.
|
|
|
|
|
What is a point? How do you want to write down as codes?
|
|
|
|
|
norish wrote: What is a point?
A point is an entity that has a location in space or on a plane, but has no extent.
|
|
|
|
|
thank you, i had tried and it can't do.
|
|
|
|
|
Hi Friends,
How can I Access CDialog Class Member Variables in CDocument Class For Some Process...i Tried a lot..but it give error..plz gve me a solution ..
|
|
|
|