Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

error on startup of MFC application

I have an MFC C++ application using Measurement Studio 6.0, NI-Daq 7.4.4, running on an XP Pro desktop.  The app was built with Visual Studio C++ 6.0 SP5. 

 

When I try and execute the application from the IDE after building it without error, I get a popup stating

 

The application failed to initialize properly (0xc0000142).  Click on OK to terminate the application.

 

 If I try to debug the application (use F5 to start) I get the same popup followed by another:

 

Unhandled exception in <app name> (NTDLL.DLL): 0xc0000142: DLL initialization failed.

 

Is there some way for me to determine exactly which DLL is the problem?  I don't see how it would be NTDLL, it's on the system and is a microsoft OS dll, not an NI dll.  I am running with the hardware, but this fails most likely in the attach process or attach thread section of some dll main which is returning an error code.  Does NI-Daq act like this if there's no HW present? Does  ComponentWorks or ComponentWorks++?  

 

How can I tell if ComponentWorks and ComponentWorks++ are in fact installed and available to the executable?  Are these .ocx files, or are these MS components aggregated into a DLL?  Does MS 6.0 breakout into ComponentWorks and ComponentWorks++ the way MS 1.0 does?   All I see in add/remove programs list or the NI MAX is "MeasurementStudio" when I use MS 6.0.

 

Thanks for any help on this, I'm asking a lot of questions.  This is a steep learning curve to be sure ...

 

Menchar

 

 

0 Kudos
Message 1 of 7
(10,163 Views)

Menchar,

 

Where did you get this application, and has it ever worked before? What version of Measurement Studio, Visual Studio, and NI-Daq was it built on ? If it has worked before, what changed, and is it possible to strip down any parts, so you can test the pieces individually rather than the program as a whole? Also are you getting NTDLL errors while doing anything else on this computer? It may be a corrupt NTDLL.dll file http://www.downloadatoz.com/howto/How-to-resolve-ntdll-dll-error.html.

 

You can view the OCX file path if you  go to Project » Add to Project » Components and Controls and select a specific CW control under the Registered ActiveX Controls. I have attached a screenshot showing an OCX file pat.

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 2 of 7
(10,126 Views)

Richard -

 

Yes, the app has worked before, I am running without hardware but this shouldn't prevent DLL's from loading, or maybe it would?  Popup says DLL failed to initialize, maybe it loaded all OK but failed to initialize because no NI hardware was present?

 

MS 6.0, NI Daq 7.4.4, WinXP SP2,  VS C++ 6.0 SP5.

 

Suspect NTDLL is OK, I can run another MFC program from same setup and works fine.

 

App uses NI PCI 6543 an NI6023E.

 

Come to think of it though, the app is trying to do serial I/O using NI components and the new PC I'm running on has no serial ports!!  So maybe NI component that does rs-232 i/o is unhappy when the app starts up and loads dll's, components??  Reports as if NTDLL problem?

 

Thanks for your respone.

 

Menchar

 

0 Kudos
Message 3 of 7
(10,123 Views)

Menchar,

 

That error message isn't very helpful and your symptoms aren't very telling.  If there was a specific problem calling to serial ports, the error message should be a little more indicative of a serial error. Can you put this application on another computer and successfully debug it? If you don't have another computer available, can you post some code to the forum, and I can try running your code. 

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 4 of 7
(10,107 Views)
I am experiencing the same error.  Windows XP Pro SP3, MS Visual C++ 6.0 SP4.  DIO-32HS with NI-DAQ 7.4.1 Example code from the installation CD.  When running as an (local or domain) Administrator or (local) Power User the application works fine.  Change to Limited User and the error is exhibited.  All developers must target "Domain User" privileges.  Under MS Server 2008 the "Power User" is not an option.  Tried setting "Domain User" privileges to "full control" on the windows and system32 folders, no change in error.  Domain User still has issue.  The information that is stated is all that NTDLL.dll will provide back to the developer.
0 Kudos
Message 5 of 7
(9,034 Views)
If it works some times, but not when the user is a non-administrator then it sounds like a seperate problem. Have you tried the steps in this post? http://digital.ni.com/public.nsf/allkb/BB393E7B361E939886256EFD007AC591
Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 6 of 7
(9,009 Views)

I had to accomplish what is stated in that post.  That is not a prudent fix in my situation.  What I have noticed is that DAQmx does not have this problem so it appears that I will have to have the designers change direction and use DAQmx instead of the Traditional NI-DAQ.

 

Thank you for your time.  Smitty

0 Kudos
Message 7 of 7
(9,007 Views)