11-21-2005 11:33 PM
11-21-2005 11:44 PM
so i want to convert from NIVisaCom.dll to VisaCom.tlb by the tools TlbExp.exe supported bt Visual.Net from MS, but this little tools says that the dll file was not in correct format and canot be converd.:(
and so i google the VisaCom.tlb file from internet, funny , i find one topic reply by Agilent, the reply without any words, but just with a attatced file VisaCom.tlb. so download this file and move to my project location, compling and building was all okay 🙂
but, ifi run the exe , it says Runtime error , and abnormal program teninate. If i debug the application in IDE , it says Unhandled exception in XXXX.exe Kernel32.dll and crashed:(
11-22-2005 02:02 AM
11-22-2005 03:13 AM
11-22-2005 08:24 AM
You can find GlobMgr.DLL placed at C:\VXIpnp\VisaCom directory. Instead of importing from VisaCom.TLB, you can #import the same contents (Type Library info) from this DLL. Now the GlobMgr.DLL is of VISA 3.0 spec, therefore it does match with the latest NI-VISA DLLs.
#import "C:/VXIpnp/VisaCom/GlobMgr.DLL"
11-22-2005 08:02 PM
11-23-2005 06:04 PM
What error code (HRESULT) was returned from raw_Initialize() call ?
Also, how did you initialize the variable "dmm" ?
11-23-2005 07:31 PM
initalizing process is as following, all was okay.
HRESULT hr;
try{
if (FAILED(hr = CoInitialize(NULL))){ <------no question, hr= -858993460
AfxMessageBox("Fail CoInitialize() method");
return FALSE;
}
dmm = NULL;
// Create a safe pointer for interface access
if (FAILED(hr = dmm.CreateInstance(__uuidof(Agilent34401)))){
AfxMessageBox("Fail CreateInstance() method");
return FALSE;
}
}
catch(_com_error err){
AfxMessageBox (err.Description());
}
if (FAILED(hr = dmm->Initialize(m_address.AllocSysString(), VARIANT_TRUE, VARIANT_TRUE, ""))){
AfxMessageBox("Fail Initialize() method");
exit(1);
}
the initialize() funtion goes into following ::initialize()
inline HRESULT IIviDriver::Initialize ( _bstr_t ResourceName, VARIANT_BOOL IdQuery, VARIANT_BOOL Reset, _bstr_t OptionString ) {
HRESULT _hr = raw_Initialize(ResourceName, IdQuery, Reset, OptionString); <---here, fitstly hr= -858993460 the same as before
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this)); <--- but, finally hr= -2147219965 and error occured 😞
return _hr;
}
11-23-2005 08:15 PM
The HRESULT code -858993460 (= 0xcccccccc) is very strange because it is an uninitialized junk value. Does your code returns 0xcccccccc when calling CoInitialize() function?
Also I suspect the calling result of dmm.CreateInstance(). Does it surely return S_OK (= 0) and the "dmm" (probably a VC++ smart pointer, IAgilent34401Ptr type) contains a valid IAgilent34401 interface pointer address after the CreateInstance() call? If it fails, your problem is at the initialization process of the IVI-COM Agilent34401 object instance.
The error code -2147219965 (= 0x80040603) is likely categorized to VISA-COM error code area, but I could not find it in VISA specifications. I also checked it with Error Lookup tool but no message was found therefore it was not a Microsoft error code too.
11-23-2005 11:48 PM - edited 11-23-2005 11:48 PM
このメッセージは 11-24-2005 02:49 PMに Makoto が編集しています。
このメッセージは 11-24-2005 02:50 PMに Makoto が編集しています。