15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Problem running MFC program...

Daniel R. Israel -- disrael@crl.com
Wednesday, March 05, 1997


Environment:  Windows 3.1, VC++ 1.52c


I am developing a suite of MFC applications.  Each application uses the MFC
DLL and a CFormView as it's main window.  One of the applications is an
"App Manager" that runs others.  Suddenly, one of the applications refuses
to run when called from the app manager.  It is ASSERTING in WinCTRL.CPP
(284) which is where the controls on the FormView are being mapped to
variables (doesn't matter which one).  If I just dbl-clibk the icon, it
runs fine.

So, to solve this, I wrote another MFC program that loads and unloads DLLs
(to see if a particlar DLL was causing it) and if I run this program (but
don't load any DLLs) my problem program will crash!

This leads me to believe that there is a possible problem with 2 different
programs using the MFC DLL libraries at the same time (although this is my
first encounter with it...).  Has anyone any ideas on this matter?  Thanks!


-Akeem
http://www.crl.com/~disrael




Daniel R. Israel -- disrael@crl.com
Thursday, March 06, 1997

[Mini-digest: 2 responses]

At 09:08 AM 3/5/97 +0000, you wrote:
>
>Environment:  Windows 3.1, VC++ 1.52c
>
>
>I am developing a suite of MFC applications.  Each application uses the MFC
>DLL and a CFormView as it's main window.  One of the applications is an
>"App Manager" that runs others.  Suddenly, one of the applications refuses
>to run when called from the app manager.  It is ASSERTING in WinCTRL.CPP
>(284) which is where the controls on the FormView are being mapped to
>variables (doesn't matter which one).  If I just dbl-clibk the icon, it
>runs fine.
>
>So, to solve this, I wrote another MFC program that loads and unloads DLLs
>(to see if a particlar DLL was causing it) and if I run this program (but
>don't load any DLLs) my problem program will crash!
>
>This leads me to believe that there is a possible problem with 2 different
>programs using the MFC DLL libraries at the same time (although this is my
>first encounter with it...).  Has anyone any ideas on this matter?  Thanks!

I've now gotten more information on this.  Seems when I run one program, I
map a button on the Form View to a CButton in the object.  I do the same
thing in the second program.  This causes an ASSERT.  So, I tested this.
If I map the CONTROL to an object (opposed to the data), I cannot map
another of this same type of control (causes an assert).  I tested this
with two small programs and the second program running ASSERTs out every
time, but they all run by themselves.

So, since I wasn't really subclassing these (which is what DDX_Control
does) controls, but using a variable to prevent using the GetDlgItem all
the time, I just changed the variables to pointers and did a GetDlgItem in
OnInitialUpdate and it now works fine.  Is there another way around this?
(I cannot force the other 40 programmers here to do this as well.)

-Akeem
http://www.crl.com/~disrael

-----From: Chandrasekar Venkataraman 

Hi,

When you have two applications (using the MFC DLL Version) running on =
Win95 or WinNT you wouldn't
possibly face this problem as the DLL (MFC40 or MFC40D) gets loaded into =
an unique address spce of
the application that uses the DLL.=20

In case of Windows 3.x the DLL should be written in such a way which =
takes cares of Multiple instances, but unfortunately the people who have =
written the DLL version of the MFC libraries have decided not to support =

Instancing of the Global Data that MFC's DLL uses, this implicitly =
states that you have to have only one application=20
(which uses the DLL version of MFC) running, if you run another instance =
then the application will surely Crash=20
as it would corrupt the Global Data of the DLL (b'coz of the DLL loading =
mechanism in Windows 3.x).=20

Though I think that this is the Problem, I couldn't find a solution to =
it... Maybe there are others like me and others
who have found a solution, might be good if we get an answer to this...

Hope this helps you...
/Chandru


----------
From:  Daniel R. Israel[SMTP:disrael@crl.com]
Sent:  Wednesday, March 05, 1997 3:09 AM
To:  mfc-l@netcom.com
Subject:  Problem running MFC program...


Environment:  Windows 3.1, VC++ 1.52c


I am developing a suite of MFC applications.  Each application uses the =
MFC
DLL and a CFormView as it's main window.  One of the applications is an
"App Manager" that runs others.  Suddenly, one of the applications =
refuses
to run when called from the app manager.  It is ASSERTING in WinCTRL.CPP
(284) which is where the controls on the FormView are being mapped to
variables (doesn't matter which one).  If I just dbl-clibk the icon, it
runs fine.

So, to solve this, I wrote another MFC program that loads and unloads =
DLLs
(to see if a particlar DLL was causing it) and if I run this program =
(but
don't load any DLLs) my problem program will crash!

This leads me to believe that there is a possible problem with 2 =
different
programs using the MFC DLL libraries at the same time (although this is =
my
first encounter with it...).  Has anyone any ideas on this matter?  =
Thanks!


-Akeem
http://www.crl.com/~disrael






Become an MFC-L member | Вернуться в корень Архива |