05-01-2009 04:55 PM
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
05-05-2009 05:13 PM
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.
05-05-2009 05:35 PM
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
05-06-2009 02:35 PM
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.
04-29-2010 09:15 AM
04-30-2010 01:40 PM
04-30-2010 01:46 PM
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