|
I've built an SDI application without problems, adding classes. When I've linked a thirdy party library i've had to change compiler switch from Multithreaded (/MT) to Multithreaded DLL (/MD) and adding the _AFXDLL symbol to properly compile the entire project. The project is linked with the shard version of MFC.
When the application exits, i've noticed a lot of memory leaks and that classes destructors are not invoked (CView derived class and CMainFrame destructors are invoked, but CDocument destructor and other
classes destructors are not invoked).
I can't understand the causes of this problem and if the /MD compiler option is one of them.
Any idea ?
|
|
|
|
|
Take a look at where and how you create an instance of the class. The probable cause is that you have created an instance somewhere with the keyword new, and you are failing to call delete. If that class has other classes as members, their destructors will in turn fail to be called.
|
|
|
|
|
Dear all
I Write one class in Visual C++ which is responsible for logging of stream data.
This Class is used in a dll which is used to contact to hardware.
I want to enable the logging capability in some special times.
But Because this class is used in a dll file, I can not access it via keyboard or mouse. (I dont access the program that uses my dll.)
thus I need an interface to inform my class to enable or disable logging process.
for an example I can create a file in a special place, and my class check the existence of that specific file as a sign of logging permission.
But this solution is not professional.
Thus please send me your idea about this problem.
Thanx in advance
Mahdi
|
|
|
|
|
Depends a lot of how you 'use' your dll. Is this class exported by your dll ? If yes, simply treat exactly the same way as if it was part of your application (so, add a function in the class to enable or disable the logging). If it is not exported, you can still export a function in your dll that will allow to enable or disable the logging.
|
|
|
|
|
m_monhi wrote: But Because this class is used in a dll file, I can not access it via keyboard or mouse. (I dont access the program that uses my dll.)
Can you explain this? To able to use your class that logs. There should be some application that uses it?
|
|
|
|
|
m_monhi wrote: This Class is used in a dll which is used to contact to hardware.
Can you modify the EXE that uses your DLL?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi,
i have a static text control in a dialog box ,how to find the dimensions of the static text.
thanx in advance,
zari
|
|
|
|
|
CRect rc;
GetDlgItem(IDC_STATIC_TEXT)->GetWindowRect(&rc);
Jesus loves you. But I'm his favorite.
|
|
|
|
|
i am getting an error by placingbthe given lines o9f code in ONINIT of my dialog.
can ne 1 help me???
zari
|
|
|
|
|
have you given the static control an ID the defailt is IDC_STATIC change that to something else and use that instead of IDC_STATIC_TEXT
Jesus loves you. But I'm his favorite.
|
|
|
|
|
YES i hav used the same ID in that place but it doesnt work out.wen i use control tab the PARAMETER idc_static IS NOT PRESENT IN THE LIST.
zari
|
|
|
|
|
zareee wrote: ...idc_static IS NOT PRESENT IN THE LIST.
It's not supposed to be. That's why it's a special ID.
Why can't you just give your static control a different ID?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
if you have a variable for static control use CRect rect;m_Static.GetWindowRect(&rect);
|
|
|
|
|
WhiteSky wrote: you have a variable for static control use CRect rect;m_Static.GetWindowRect(&rect);
for adding Variable to static control you have to Change It's Special ID IDC_STATIC to something else
"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 know what problems?
|
|
|
|
|
WhiteSky wrote: I know what problems?
"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
|
|
|
|
|
zareee wrote: i have a static text control in a dialog box ,how to find the dimensions of the static text.
for adding Variable to static control you have to Change It's Special ID IDC_STATIC to something else, after changing id of static control from properties window.. follow advice from White Sky
"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
|
|
|
|
|
Hi,
I am working on one CAD application. Application is developed in MFC with document view architeture. In my application there are different views of same geometry object. Views are like FRONT, BACK, TOP etc. Now I want to print all view on same page. In this case TOP view should be in center and all other views should be on different side of TOP view. Is this possible in MFC and if yes then how?
Thanks & Regards,
Kalpesh
|
|
|
|
|
Hi everybody,
in a CFormView i like to catch the CTRL and Down-Key if i'm at the Grid...
Exists a special key-code for this combination? So that i can catch it over the KeyDown-Event ?
Or only over Accelerators ( But Accelerators working with the MainFrame )
Thanks
|
|
|
|
|
baerten wrote: in a CFormView i like to catch the CTRL and Down-Key if i'm at the Grid...
Overriding PreTranslateMessage should help.
|
|
|
|
|
thanks
yes i did it already for the ENTER Key...
But in the CTRL + DOWN case i must test if two keys were pressed
Must i store the first key in a variable ( activate by on KeyDown, release on KeyUp )
and test so the second key
Or exists a special keycode for double-pressed keys ?
|
|
|
|
|
In OnKeyDown (no, thats not the handler for the Down-key pressed )
you could check for any key-combination like this:
if (Key==VK_DOWN && GetKeyState(VK_CONTROL))
Or, you would check it in PreTranslateMessages:
BOOL CSomeFormView::PreTranslateMessage( MSG* pMsg)
{
if ( WM_KEYDOWN == pMsg->message )
{
switch (pMsg->wParam)
{
case VK_UP:
{
if( GetKeyState(VK_CONTROL))
{
OnUp();
}
break;
}
case VK_DOWN:
{
OnDown();
break;
}
case VK_SPACE:
{
OnStop();
break;
}
}
}
return CFormView::PreTranslateMessage(pMsg);
}
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
if (Key==VK_DOWN && GetKeyState(VK_CONTROL))
works perfectly
Big thanks !!
bzw DANKE
|
|
|
|
|
Hello,
is there any way to set an tabitem inactive,disabled?
Mean, whenn i start my program, the tabitems(2-5) should be disabled?!
Thank you for help.
break;
|
|
|
|
|