|
Hi,
That (SetActiveView ) is also not working.
|
|
|
|
|
Sakhalean wrote: That (SetActiveView ) is also not working.
Of course it's working. Is your view attached to your child frame?
|
|
|
|
|
yes my view is attached to its child frame.
|
|
|
|
|
So, you have two problems...
When you click on the treeview node, you need to...
1/ open a view of the right type if it doesn't already exist.
2/ activate a view you've already created.
Are there multiple documents also?
Let's imagine this application:
A tree on the left. Parent nodes represent documents, and child nodes represent possible views. You can use CTreeCtrl::SetItemData to store a pointer to the CMyDocument at each parent node. And store a pointer (or NULL) for any CMyView objects in the child nodes.
The main trick is to make sure that closing a view sets the ItemData back to NULL in the views destructor.
Now it's just a case of being careful.
You can use a intermediate view class between CView and all your specialised view classes that do the book keeping so you only have to be careful in one place.
Good luck! Do let us know how it goes.
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
OK I have solved that problem after struggling two days.
But it was very simple.
Thank you
|
|
|
|
|
I'm glad your problem is now solved, and I hoped we helped.
Good luck with your future endeavours,
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
Dear all,
I want to know how to hook Microsoft Office File Open/Save Dialog box.
My exact requirements are as follows:
1. To get the full path of the MS office file that is opened(it could be word, power point or excel file)
2. If the user saves the file using "save as" option, I would like to get the full path of the target file
I appreciate any help in this direction.
I am using VC++ on windows XP
Thanks in advance........
Dinakara K
CAIR, Bangalore
|
|
|
|
|
I have mfc sdi aplication and i need to change the popup menu text
i can chage the submenu items by ading event handler ON_UPDATE_COMMAND but i cant do with the file menu because i dont have an id.Anyone knows a function to do that?
Thank You.
|
|
|
|
|
You can probably find some useful function in the CMenu[^] class.
It's time for a new signature.
|
|
|
|
|
There are id's there too. Have a look in your menu resource, and you will find the appropriate identifiers.
ID_FILE_OPEN
ID_FILE_CLOSE
ID_FILE_SAVE
ID_FILE_SAVE_AS
...
I hope you're not trying to use numbers instead of identifiers.
|
|
|
|
|
thak you i find them but i cand find for the FILE
i have FILE -???
NEW ID_FILE_NEW
OPEN ID_FILE_OPEN
but the File dont have
|
|
|
|
|
Ok, I misunderstood what item you wanted to change. See Richards answer above.
You can get the menu of the CMainFrame using GetMenu()
Look at this entry for a sample:
CWnd::GetMenu()[^]
The pMain will be your CMainFrame pointer.
|
|
|
|
|
Hi I am using CTreeCtrlEx example of code project.
I have added one function which will expand a node of tree if it has children.
void CTreeCtrlEx::ExpandEx(HTREEITEM item, UINT nCode)
{
this->Expand(item, nCode);
}
calling like this
if(shouldExpand)
m_OutlookFolders.ExpandEx(expandableNode, TVE_EXPAND);
It's working fine in Windows XP but not working in Vista/Windows7
Any way to do that in both OS ??
Thanks,
Rahul Kulshreshtha
|
|
|
|
|
It would be best to post this question in the Discussion list at the end of the article page.
|
|
|
|
|
In that case, only article writer may give the answer. But what if I want answer from other peoples like you. You post excellent answers here and if I post this question in Article-Discussion then I will not be able to get answers from you and other people's who have a great solution and mind.
Please give answer here.
|
|
|
|
|
Why I said that was because, the author has written the code and he/she would be inquisitive as to why it does not work in a newer OS.
I'm not discouraging you from posting in the general forums.
|
|
|
|
|
Thanks I posted in that article.
My problem has been solved. This was a silly mistake. Actually parent node was expanding in win7 also but that parent node was also having another parent node which I was not expanding and I was thinking that nothing is getting expand. I should recursively expand all it's parent nodes
Regards,
Rahul Kulshreshtha
|
|
|
|
|
Are you saying there was a difference how this was handled in XP and Win7?
|
|
|
|
|
No!!! Actually my XP machine was having a Tree with only two level and my Win7 machine was having Tree with 4 level of data.
I was expanding only parent folder of some node(detected by some rules) so in windows XP, I was able to see changes while in Win7 it was expanding parent folder of some node(detected by some rules) but as the detected node was on 4th level of tree so only it's parent (3rd level node) was getting expand. 2nd level and 1st level node was not getting expand because I was not expanding them. So I changed my logic to expand all parent in hierarchy and that worked
|
|
|
|
|
Well, that's a relief.
|
|
|
|
|
rahul.kulshreshtha wrote: In that case, only article writer may give the answer.
Not true. Anyone may answer.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hello,
I am getting this error :
0x80040154 Class not registered
I already done regsvr32 for the C++ dll file.
When I check the registry, I can find the entry at HKEY_CLASSES_ROOT\CLSID.
InProcServer32 has the dll path as the default while threading model is Apartment.
When I run the client software, it fails with Class not registered error.
Your guidance on solving this problem is very much appreciated.
Thanks,
Goutam
|
|
|
|
|
How are you loading the COM component?
Are you certain that you called CoInitialize ?
|
|
|
|
|
Thank you for trying to help me.
Yes. I am loading the COM component.
The returned values are as below :
hr_init = S_OK.
hr_init2 = Class not registered
I called the CoInitialize as below :
HRESULT hr_init = CoInitialize(NULL);
if (FAILED(hr_init))
{
return E_FAIL;
}
CLSID CLSID_EventFiringObject_Tmp;
CLSID_EventFiringObject_Tmp = __uuidof(IEventFiringObject_OD);
// ***** Create an instance of an object which implements IEventFiringObject. *****
// HRESULT hr_init2 = m_spIEventFiringObject.CreateInstance(__uuidof(IEventFiringObject_OD));
HRESULT hr_init2 = m_spIEventFiringObject.CreateInstance(CLSID_EventFiringObject_Tmp);
if (FAILED(hr_init2))
{
return E_FAIL;
}
// ***** Instantiate an IEventFiringObjectEventHandler object. *****
m_pIEventFiringObjectEventHandler = new IEventFiringObjectEventHandler(*this, m_spIEventFiringObject, &CManualTest::OnEventFiringObjectInvoke);
|
|
|
|
|
HRESULT hr_init2 = m_spIEventFiringObject.CreateInstance(__uuidof(IEventFiringObject_OD)); In the above line, the parameter of __uuid must be the coclass name and not the interface name.
|
|
|
|