|
What is the way I can debug reference counting ? Can I print out a list of all AddRef() and Release() calls ?
|
|
|
|
|
#define _ATL_DEBUG_INTERFACES in your stdafx.h and rebuild. this will show you every AddRef and Release.
-c
Conservative:
One who admires radicals centuries after they're dead.
-- Leo C. Rosten
|
|
|
|
|
It seems that if compile a DLL under VS.NET, I'm no longer able to use it from an executable compiled under VS 6.0 (even if re-compiled) .
Does anybody know about the MFC 6.0 / MFC 7.0 compatibility issues ?
Exe using MFC 6.0 with a DLL using MFC 7.0 ?
Exe using MFC 7.0 with a DLL using MFC 6.0 ?
All are compiled with dynamically linked MFC libraries.
Thank you for your answers !
|
|
|
|
|
It stands to reason that if your app is compiled to use MFC 4.x and your DLLs are using MFC 7,0. you'll have problems.
Link statically.
|
|
|
|
|
i have defined a global handle to MUTEX and creating it in one funtion and releasing in the other funtion, but it won't allow me to do so. what to do for it. i need to own it. how it is possible
|
|
|
|
|
Before release it,you should unlock it first
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
You can't have one thread aquire the mutex and another release. If you are trying to do this in the same thread, then you have other problems.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Hello friends,
for what are the 4 digits (x.x.x.x) mostly used? I mean for what should i use the four digits?
Sorry for this silly questions, but i really want to know that.
Thank you for your help!
Fiffi
|
|
|
|
|
Version numbers:
Major.Minor.Patch.Build is what we use it for.
1.2.1.53
Version 1.2A build 53.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Hello Tim,
Thank you very much for your Help!
Fiffi
|
|
|
|
|
major.minor.patch.build
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
Hi,
I'm dynamically creating an object like this:
CRuntimeClass * p_Rt;
p_Rt = RUNTIME_CLASS(CMyClass);
m_pMyClass = (CMyClass *) p_Rt->CreateObject();
which works fine. But how can i delete this object (the m_pMyClass) ?
if i try to delete it, i get a compiler error because the destructor in CMyClass is protected (becuase thats what classwizard set it to be; part of the whole DYNCREATE thing).
if i don't delete it, i get a memory leak. I must be missing something i think.
thakns jon
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
1) Do you really need the DYNCREATE features?
2) you can freely move c'tor and d'tor to public section and call the directly:
CYourClass *p = new CYourClass;
delete p;
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Not sure if i need DYNCREATE. I need automation, which MSDN leads me to believe depends on DYNCREATE.
Jon
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
Jon Hulatt wrote:
if i try to delete it, i get a compiler error because the destructor in CMyClass is protected (becuase thats what classwizard set it to be; part of the whole DYNCREATE thing).
IIRC, that's a minor bug/feature in the class wizard. You can just change the destructor to be declared public, and voila, problem solved. DYNCREATE doesn't care about the destructor, it just needs a default constructor.
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
I need to set a checkmark on one of the MenuItems in the menu of the CMDIChildWnd in a program based on the multiple document doc/view architecture. How do I do that?
I think I know how to set the check mark I just can't figure out how I get access to the right CMenu? (Untill now I've only managed to get access to the CMainFrame menu)
Hope somone can help
I also committed the crime of posting a programming question in the Lounge.
|
|
|
|
|
You'll need to handle UPDATE_CMD_UI for appropriate command and use CCmdUI::SetCheck. This will result in checkmark next to menu item.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Take a look at CMDIChildWnd::OnUpdateFrameMenu.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Why not just use an update handler (ON_UPDATE_COMMAND_UI) and forget about trying to get hold of the menu item? Update handlers are an easier and clearer way of controlling the state of menu items, and have the added bonus of handling things like toolbar buttons at the same time.
But if you still insist on trying to use the menu pointer, the main reason you're having trouble is that MDI child windows don't have their own menus. Only the main frame window has a menu, it just changes its menu when different child windows are activated.
If you're still interested, have a look at the source code for CMDIFrameWnd and CMDIChildWnd (in AFXWIN.H and WINMDI.CPP), in particular at OnUpdateFrameMenu . The code responsible for swapping the main frame's menu in MDI apps is not very well documented in the MFC docs, but the source code is fairly clear (as far as MFC source goes).
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
Hmmm .. I think I wasn't quite specific enough describing my problem.
My problem is this; When the menuItem is clicked a modeless CDialog box is popped up and SetCheck is called to mark the menuItem. If I click the menuItem again the Cdialog box disappears and so does the check mark, I have managed to get that far
Now my problem is that CDialog box itself also has a close button that closes the box but I cant manage to remove the checkmark when the dialog box is closed through this button ... how can I solve that?
I also committed the crime of posting a programming question in the Lounge.
|
|
|
|
|
I'd still tend to use an update handler (probably in your main frame window, but it depends where you can get at the pointer to your modeless dialog from), something like this:
OnUpdateMenuItem(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_pDlg && m_pDlg->IsWindowVisible());
}
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
Hi friends,
I am calling a Dialog Box from a message handler function in my View class. In 'oninitdialog' of the dialog class I want to update this dialog box with some linked list which is declared public in the my View class. I want to access this Linked list and modify in the Dialog class when the user wants any modification. How to access this? Thanks in advance.
|
|
|
|
|
Put a pointer to your view into the dlg class before you call DoModal.
CYourView::OnShowDialog()
{
CYourDlg dlg;
dlg.m_ParentView = this;
dlg.DoModal();
}
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Sorry steen I couldn't get ur answer, I didn't put the question right first time, please see my question. Thanks
|
|
|
|
|
Lemme get this straight: You have a linked list that is a member of your view class. From the view class you instantiate a dialog. In the dialogs OnInitDialog you want to access the linked list.
If this is correct, the my previous answer is still valid. Make a member variable in your dialog class:
class CYourDialog : CDialog
{
....
public:
CYourView* m_pParentView;
}
Initialize the m_pParentView pointer in the view class before calling DoModal on the dialog class:
void CYourView::OnShowDialog()
{
CYourDialog dlg;
dlg.m_pParentView = this
dlg.DoModal()
}
Then you can to access the linked list in OnInitDialog:
BOOL CYourDialog::OnInitDialog()
{
...
m_pParentView->m_LinkedList = ...
}
If I have misunderstood your problem then please rephrase or provide a code snippet illustrating the problem.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|