473,408 Members | 1,623 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Windows Service (C++/CLI) with MFC

I want to write a windows service (myService) by using C++/CLI (Visual Studio 2005). This myService can use MFC function for OLE Automation.

Just for a first try, I did the following project configuration and coding:

• Creating a Windows Service under C++/CRL
• Adding ServiceInstaller with start type automatic and sereviceprocessInstaller with Account Local System
• Setting MFC in a Shared DLL
• Setting Common Language Runtime Support (/clr)
• Setting Multithreaded-Debug-DLL (/MDd)
• Adding #include <afxdisp.h> in stdafx.h

Compile is always successful. But when I use myServie.exe –Install to install my windows service in Visual Studio 2005 Command Prompt, I always get the following exceptions

When debugging:
Unhandled exception at 0x78374588 (mfc80ud.dll) in myService.exe: 0xC0000005: Access Violation reading location 0x00000000.

In Visual Studio 2005 Command Prompt:
Unhandled exception: System.AccessViolationException
Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.
at _wWinMainCRTStartup()

Does anyone know the reason? Where am I wrong?

Many thanks for any help!
Jul 17 '08 #1
1 6934
Banfa
9,065 Expert Mod 8TB
Trying to mix MFC and clr sounds to me like an extremely bad idea. I do not think there is anything that can be done with MFC that can't be done with .NET, you are mixing a ancient technology that is basically just a bloat code wrapper with the current technology.
Jul 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: yawnmoth | last post by:
The portion of the PHP manual entitled "Using PHP from the command line" states that "The CGI SAPI supports the CLI SAPI behaviour by means of the -C switch when run from the command line.": ...
0
by: Colin Brown | last post by:
Python2.3.2: Running the following receiver and sender code in separate windows under Win2K does not work properly (missed & very delayed transmissions). Under Redhat Linux 9 (where I will be using...
8
by: doug.h.taylor.accipitersoftware.com | last post by:
Hi, I need a general direction. I don't even know where to start researching how to do this. I have an existing dot net web application (It's mine, I wrote it) that has some text fields and...
2
by: Spudster3 | last post by:
Does anyone have a good solution to run a Command Line Script as a Windows Service, and be able to monitor it via Telnet (Or better yet SSH)? I have a small maintanance script that I would like...
7
by: Sunil Varma | last post by:
Hello all, I wrote a Windows Service in VC.NET 2005 I want to debug the solution. I tried as mentioned in the following link. ...
4
by: Volker Hetzer | last post by:
Hi! After messing around for some time with Tcl/Tk and VBScript, we've finally reached the point where we need to put some speed into our applications. So, our typical application looks like...
8
by: Todd Jaspers | last post by:
Hey guys, I've written a fairly simple Windows C# Application using Visual Studio 2005. I have to manually run it, but I would prefer to have it run on it's own, as if it was a Windows NT...
2
by: nicolas.hilaire | last post by:
Hi all, is it possible to make a .Net service with C++/CLI with the support of MFC library ? I have made a C++/CLI service, that works perfectly. Then I add MFC support, without using it (only...
0
by: kieferzhen | last post by:
I want to write a windows service (myService) by using C++/CLI (Visual Studio 2005). This myService can use MFC function for OLE Automation. Just for a first try, I did the following project...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.