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

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


Using MFC in an NT service

David Budworth -- david@metra.com
Monday, June 24, 1996

Howdy all,

MSVC 4.0
WinNT 3.51 SP4

I am writing a service that uses MFC 4.0 extended classes in it (CString,
and CTime)

It seems, then when the service gets the stop message, and I do a "return"
from the ServiceMain function.  The App just dies...
Process stays in memory, but no longer running.

The app was created with MSVC 4.0 as a console app, and I changed the
General Settings to use MFC in a static library.

A while ago, I also tried this, but made a CWinApp based service.  It
worked, but the same thing happens, never returns after
StartServiceCtrlDispatcher is done.

Anyone know something magic about services  and MFC?

Thanks,
-David

p.s. Currently the source is nothing specific, the service just writes the
time to a text file every 10 seconds...  So if need be, I can upload the
source.  In total it is 100 lines.





Eugenio Miro -- emiro@datamarkets.com.ar
Monday, November 11, 1996

Hi
Have you told the service control manager you're app is diing. You must =
tell it, if you don=B4t your process will never returns from =
StartServiceCtrlDispatcher.

Eugenio

----------
From: 	David Budworth
Sent: 	Monday, June 24, 1996 8:07 AM
To: 	mfc-l@netcom.com
Subject: 	Using MFC in an NT service

Howdy all,

MSVC 4.0
WinNT 3.51 SP4

I am writing a service that uses MFC 4.0 extended classes in it =
(CString,
and CTime)

It seems, then when the service gets the stop message, and I do a =
"return"
from the ServiceMain function.  The App just dies...
Process stays in memory, but no longer running.

The app was created with MSVC 4.0 as a console app, and I changed the
General Settings to use MFC in a static library.

A while ago, I also tried this, but made a CWinApp based service.  It
worked, but the same thing happens, never returns after
StartServiceCtrlDispatcher is done.

Anyone know something magic about services  and MFC?

Thanks,
-David

p.s. Currently the source is nothing specific, the service just writes =
the
time to a text file every 10 seconds...  So if need be, I can upload the
source.  In total it is 100 lines.



Samuel R. Blackburn -- sblackbu@csc.com
Wednesday, November 13, 1996

You may want to take a look at the freeware Win32 Foundation Classes
(WFC) class library. It has a couple of classes that deal with services;
CService (handles the worker thread) and CServiceControlManager (handles
installing/removing/starting/stopping/etc). At the very least you can see
how
the source code works.

http://ourworld.compuserve.com/homepages/sam_blackburn/wfc.htm

Hope this helps,

Sam




From: 	David Budworth
Sent: 	Monday, June 24, 1996 8:07 AM
To: 	mfc-l@netcom.com
Subject: 	Using MFC in an NT service

Howdy all,

MSVC 4.0
WinNT 3.51 SP4

I am writing a service that uses MFC 4.0 extended classes in it =
(CString,
and CTime)

It seems, then when the service gets the stop message, and I do a =
"return"
from the ServiceMain function.  The App just dies...
Process stays in memory, but no longer running.

The app was created with MSVC 4.0 as a console app, and I changed the
General Settings to use MFC in a static library.

A while ago, I also tried this, but made a CWinApp based service.  It
worked, but the same thing happens, never returns after
StartServiceCtrlDispatcher is done.

Anyone know something magic about services  and MFC?

Thanks,
-David

p.s. Currently the source is nothing specific, the service just writes =
the
time to a text file every 10 seconds...  So if need be, I can upload the
source.  In total it is 100 lines.





| Вернуться в корень Архива |