Program Fail to Run After Convert from VC++ 6.0 to VC++ .NET 2003

I got a VC++ 6.0 program which is a windows service. After converting to VC++ 
..NET 2003 project and fixing some coding error. It can compile and looks work 
fine. But when I run the service, it said program error and looks it cannot 
get a thread from AfxGetThread function.

Below please find a code segment which I experience the error.

Any can help on this?

	
const CString NDSApp::SERV_NAME(_T("NDS Data Delivery"));

NDSApp::NDSApp()
:CNTService("NDS Data Delivery"){
	m_pNDSSetting = new CRegKeyValuePair(APPNAME,SECTION);
}

NDSApp::~NDSApp()
{
	if (m_pNDSSetting)
		delete m_pNDSSetting;

	//if (m_pMainWnd)
	//	delete m_pMainWnd;
}

BEGIN_MESSAGE_MAP(NDSApp, CWinApp)
	//{{AFX_MSG_MAP(NDSApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()



/////////////////////////////////////////////////////////////////////////////
// NDSApp message handlers

/////////////////////////////////////////////////////////////////////////////
// CNTServices controllers

void	NDSApp::Run(DWORD argc, LPTSTR * argv) {
	ReportStatus(SERVICE_START_PENDING);
    
	CWinThread* pThread = AfxGetThread();

	if(pThread==NULL)
		pThread=AfxGetApp();

	InitApplication();


	if (pThread->InitInstance()) {
		m_SysMgr.SystemStartup();
		ReportStatus(SERVICE_RUNNING);
		pThread->Run();
	}
	else
		ReportStatus(SERVICE_STOPPED);
}

void	NDSApp::Stop() {
	m_SysMgr.SystemStop();
	CWinThread* pThread = AfxGetThread();
	pThread->PostThreadMessage(WM_QUIT, NULL, NULL);
	ReportStatus(SERVICE_STOPPED);
}

void	NDSApp::Pause() {
	m_SysMgr.SystemPause();
}

BOOL NDSApp::InitInstance() {
	AfxOleInit();
	AfxEnableControlContainer();

	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
		pMainFrame->ShowWindow(SW_HIDE);
	pMainFrame->UpdateWindow();
	m_pMainWnd = pMainFrame;
	return m_SysMgr.SystemInit();
}

int NDSApp::ExitInstance() {
	int iRes = CWinApp::ExitInstance();
	if (pLogger)
		delete pLogger;
	return iRes;
}
0
James6891 (359)
3/20/2006 2:59:42 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
211 Views

Similar Articles

[PageSpeed] 51

Reply:

Similar Artilces:

Communications Between Program and Controlling Program
Hi All, I'm looking for feedback on the best way to code communications between Programs. The architecture we are looking at is similar to Symantec AV or others - a control program sends messages to the worker program on a different machine. The worker program communicates back when complete (with a result), and gets another chunk of work. The messages will be small. What will be communicated is as follows: Control Program: Control Program Start Control Program Stop (Worker queues messages) Control Program sends a piece of work when requested Worker Program: Worker Program Start Worke...

PDF file #6
I have Publisher 2002 and would like to insert a .pdf file into a document I am working on. How do / Can I do this? Many thanks, Ger A small child turns to Ed, and exclaims: "Look! Look! A post from Ger <anonymous@discussions.microsoft.com>!"... > I have Publisher 2002 and would like to insert a .pdf > file into a document I am working on. How do / Can I do > this? It was only necessary to post once. It is not possible to import a PDF directly into Publisher, but using a tool such as Adobe Acrobat or GhostScript/GSView, you can convert the PDF into a PostScrip...

Running another program
Is it possible to run another program from within excel? The software I use at work is very repetitive and requires the same key-sequences entered many times. I got a key logger to help automate this so now I just press one key and the key logger will play back the sequence I recorded. I now want to be able to call the key logger from excel with a parameter to automate things further. Excel has its own macro recorder. Why not use it? "Stephen Miller" <StephenMiller@discussions.microsoft.com> wrote in message news:669A213C-F604-424D-A640-D90BEEDB83BC@mic...

Cannot Copy/Paste to some programs
I am using XP Home Edition and Word 2003 and Firefox browser. I find that, even though I can copy/pate between word.docs I cannot copy/paste to a Moonfruit website that I am building. I am in touch with moonfruit and it has them baffled. They are able to copy/paste to my website with no problem. I also find I cannot copy/Paste URLs from Firefox to IE browser. Any ideas? Thanks On 5 June, 15:45, Merryterry <ter...@fsmail.net> wrote: > I am using XP Home Edition and Word 2003 and Firefox browser. > > I find that, even though I can copy/pate between word.docs I ...

How do you convert numbers to real text
I want to convert numbers to real text to print on checks. 1 = One 1234.50 = One Thousand Two Hundred Thirty Four & 50/100 Does anyone know how to do this? See: http://support.microsoft.com/default.aspx?scid=kb;en-us;213360 Regards Rowan Harry wrote: > I want to convert numbers to real text to print on checks. > > 1 = One > 1234.50 = One Thousand Two Hundred Thirty Four & 50/100 > > Does anyone know how to do this? Harry, have a look here, http://www.xldynamic.com/source/xld.xlFAQ0004.html -- Paul B Always backup your data before trying something new Ple...

run two queries from one click?
This has to be easier than I'm making it. I have a form with these fields: TaskID - number Task Description - text Month Completed - text list pulled from a query Year Completed - text list pulled from a query Category - text list pulled from a query, can be more than one category per task Task Description - memo Now what I want to do is... insert TaskID, Description, Month Completed, Year Completed and Description in one table AND insert TaskID and each Category into another table with a single button click to make it easy for users. As stated above, there can be more than one cate...

vb.net congiguration settings
I would like to know how to use the ConfigurationManager for building (compiling) various parts of a VB.net 2008 windows application. Can you tell me the following: 1. How do you setup more options for 'building' configuration settings (like 'test-servera', 'test-serverb'). This would be in addition to the default options of 'debug' and 'release'? 2. If I setup a solution that has several projects in it, how could I setup 'selected project files' that I want to work with? In other words, I would to 'pick' what modules I ...

converters for word processor
I am trying to import from Word to Publisher 2003. Error message cannot use MSCONV97.dll I have updated and added converter for Office 2003 but still the same message Copy and paste. -- JoAnn Paules MVP Microsoft [Publisher] ~~~~~ How to ask a question http://support.microsoft.com/KB/555375 "Cliff" <Cliff@discussions.microsoft.com> wrote in message news:76D4BC29-C9D5-4FAA-B60E-E8CE64412AAB@microsoft.com... >I am trying to import from Word to Publisher 2003. Error message cannot use > MSCONV97.dll > > I have updated and added converter for Office 2003 but...

macro #6
Hi how can I convert a field that has an ' before the number, for example '4578 i would like to convert it to 4578 Greg Hi Greg, For a VBA solution, try: '=============>> Public Sub DeleteApostrophes() Dim WB As Workbook Dim SH As Worksheet Dim rCell As Range Set WB = Workbooks("YourBook.xls") '<<===== CHANGE Set SH = WB.Sheets("Sheet1") '<<===== CHANGE Set rng = SH.Range("A1:A20") '<<===== CHANGE For Each rCell In rng If rCell.PrefixCharacter = "'" ...

Wininet fails on one computer
My MFC application uses WinInet. On one particular computer, it throws an exception "The system cannot find the file specified" during the method SendRequest(). What's different about this computer is that it uses Firefox instead of IE. I tried installing IE7 but the problem persisted. Would it help if I actually launched IE7? I understand WinInet is somewhat dependant on IE. "Samuel Eisenpress" <SamuelEisenpress@discussions.microsoft.com> wrote in message news:259CE62D-8F7D-4EB0-BFF3-E99CCE6AA20B@microsoft.com... > My MFC application uses WinInet...

Migrating an mfc application from windows 2000 to Windows 2003
Hi, I am developing a tool in C# for the Project "Migrating an mfc application from windows 2000 to Windows 2003" in which if you are giving your application developed in windows 2000 as input then it will scan through the code in your application and find out the functions which are changed (parameter changes or deprecated) for the windows 2003 and list those functions. For that I would like to know the list of mfc function's that have obsolete and also changed in Windows 2003(but present in Windows 2000). Could you please furnish Additional URL's for our reference....

From Outlook 2010 to another program
Following a reply from Microsoft ("we know about your problem, we are working on it but currently we don't have a solution") I need to start using a different program until the problem is solved. O.S. is Seven, which is the best way to move all mails/accounts/contacts to something different? I read that Windows Live Mail doesn't import messages so I need to move to something out of Microsoft... -- /-\ /\/\ /\/\ /-\ /\/\ /\/\ /-\ T /-\ -=- -=- -=- -=- -=- -=- -=- -=- - -=- >>>>> http://www.bb2002.it :) <<<<< ............ [ al lavoro ] ......

Excel 2003 #4
Hope someone out there can help, I have lost the toolbars and menu bars in Excel, at first I thought it was showing full screen but it wasn't I then tried to Alt/V to bring up the view menu but again nothing. Have re-installed Excel but still not showing, can anyone help me with this please. And you're sure that the window isn't just too far up and off the visible viewing area--so all that you would need to do is resize that window? If you can see excel's application title bar, then this isn't the problem. If you want to reset all the toolbars back to factory default...

.NET 3.5 update failed, error #0x8007064C
Windows update downloaded and failed to install updates for .NET 2.0 and .NET 3.5 initially. Found instructions to download cleanup tool, remove both 2.0 and 3.5 and manually reinstall them. The problem with 2.0 went away, but the update installer thinks I still need the update for 3.5 and keeps trying to install it, and failing with the error code: 0x8007064C It's blocking all other updates. Please suggest how to fix it. Hello Steve, Google is your friend. A search for this error code showed this as the first of many entries: http://support.microsoft.com/kb/958055/en-u...

Outlook 2003 #357
When I recieve an email. I click in email to go to site recommened to view the information I get a pop up window that ask "Locate Link Browser" How do I fix this? I am a newbe. "gonzo44" <gonzo44@discussions.microsoft.com> wrote in message news:CA8E685F-EFAE-434F-A25A-CF08CAEAA54C@microsoft.com... > When I recieve an email. I click in email to go to site recommened to > view > the information I get a pop up window that ask "Locate Link Browser" How > do > I fix this? I am a newbe. http://support.microsoft.com/?kbid=821692 -- Bri...

Mailbox Manager #6
I am looking to use MS Mailbox Manager for retention policies on Exchange. I initially looked in to this utility when I was running Exchange 5.5 on Windows NT 4 and running it in audit mode it seemed to work great. Management nixed the plan so it was never fully implemented. Now, after reaching our 16GB IS store limit with Exchange 5.5 Standard Edition is has become a priority to put this in effect. The problem I know have is that we have moved Exchange 5.5 to a Windows 2000 Server and during the install of Mailbox Manager it fails at the service account password. Are there known issues wit...

Unnecessary messages from the outlook program + ...
Hi there... When I've pressed "send and recieve" and waited... there are two messages from the program which I think should not be necessary and could be dispensed with possibly ?? Message 1. says, new mail has arrived would you like to read it now. Message 2. says, it has been moved. we know that the email messages that it's refering to are spam and have duly been put into the norton antispam folder... so why are these messages necessary and how do we configure to get rid of them. when I press "send and recieve" at the beginning I would like to see and read em...

Return blank for true "if" statement when charting, not 0
Hi, In your formula use NA() instead of zero or "" Something like, =IF(test , NA() , False ) Cheers Andy Jay F wrote: -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info ...

Cannot run the macro 'XXX'
I am developing an Excel 2007 add-in compromising of an Excel Add-In (.xla file) and a COM Add-In (managed code written in C# in Visual Studio Tools For Office). In the start-up function of the COM Add-In I need to call a macro on the .xla file. In the installer application for the add-in I am changing the registry keys in Excel Security so that: - The Trust access to VBA project object model check box is ticked; - All macros are enabled. On a large proportion of computers that I test the add-in on, everything works fine. However there are a few computers which (when attempti...

access 2003 forms not workin access 2007
I have a routine that uses data from a form. Each time I run it, it asks for input on any field contained in the form. If I open the form then manually run the query it works fine. When I let it run throught the code, it cannot see the fields. Your suggestions are greatly appreciated. Patrick Patrick Hatton <Patrick Hatton@discussions.microsoft.com> wrote: >I have a routine that uses data from a form. Each time I run it, it asks for >input on any field contained in the form. > >If I open the form then manually run the query it works fine. When I...

Outlook Setup #6
I am posting this again because I don't think it was posted correctly before. Hello all We are using Ghost at work to image laptops but once that is done we have to configure each laptop for each user. My question is... is there a way to configre Outlook 2000 in either VB or some kind of Outlook wizard with out having to click on 10 different screens, i just want to save some time and use some kind of automation. Thanks John ...

Fatloss computer program
I have been using this computer program for a couple weeks now and i am very pleased with the results so far. its a software fatloss program, if your looking for a diet/weightloss plan i reccomend you check this place out first: http://fatloss9.50webs.com ...

Mutiple instances of Outlook 2003
I was wondering if it were possible to have mutiple instances of outlook running? So i could have diffrent profiles open to diffrent accounts. CT No. -- Jocelyn Fiorello MVP - Outlook *** Messages sent to my e-mail address will NOT be answered -- please reply only to the newsgroup to preserve the message thread. *** In news:%23BQg4RkIEHA.2524@TK2MSFTNGP11.phx.gbl, CT wrote: > I was wondering if it were possible to have mutiple instances of > outlook running? > So i could have diffrent profiles open to diffrent accounts. > > CT ...

Failed to move mailbox
Trying to move mailbox in system manager on Exchange server 2003 but failed with errorcode 0x80072020 returned. Very strange that moving mailbox using Exchange Task Wizard in Active Directory User and Computer, no problem so far. Anyone have an idea what's the problem? WTC <WTC@discussions.microsoft.com> wrote: >Trying to move mailbox in system manager on Exchange server 2003 but failed >with errorcode 0x80072020 returned. Very strange that moving mailbox using >Exchange Task Wizard in Active Directory User and Computer, no problem so >far. Anyone have an idea wha...

Word 2007 menu option missing from start programs menu
Office 2007 is installed on my computer and can only be accessed by going to the Recent Documents option and opening an existing doc. The menu selection for the program is missing from the MS Office option in the Start/All Programs menu. All other Office programs are listed. How do I get the Office 2007 program option to appear in the program menu again? ...