Josh,
This works for me. I think the documentation is a bit
confusing/convoluted. Rather than try to figure out what is wrong on
your end, it's just easier for me to show you what works on my end. Matt
is right that IXRawfile2 will work, but I know older versions are buggy
(from talking with the developers in Bremen). If IXRawfile4 works for
you, I suggest using it.
#include <iostream>
#import "XRawfile2.dll"
using namespace std;
int main(int argc, char* argv[]){
HRESULT lRet;
TCHAR pth[MAX_PATH];
XRAWFILE2Lib::IXRawfile4Ptr m_Raw;
CoInitialize( NULL );
HRESULT hr = m_Raw.CreateInstance("XRawfile.XRawfile.1");
if (FAILED(hr)) {
cout << "Cannot access XRawfile.dll" << endl;
return -1;
}
MultiByteToWideChar(CP_ACP,0,argv[1],-1,(LPWSTR)pth,MAX_PATH);
lRet = m_Raw->Open((LPWSTR)pth);
long nRet;
long i=1;
VARIANT varLabels;
VARIANT varFlags;
VariantInit(&varLabels);
VariantInit(&varFlags);
nRet = m_Raw->GetLabelData(&varLabels, &varFlags, &i);
cout << "GetLabelData: " << nRet << endl; //should be 0 if successful
int n;
int sz=varLabels.parray->rgsabound[0].cElements;
cout << "Array size: " << sz << endl;
double* pdval;
pdval=(double*)varLabels.parray->pvData;
for(n=0;n<sz;n++){
cout << pdval[n*6] << " " << pdval[n*6+1] << endl;
}
VariantClear(&varLabels);
VariantClear(&varFlags);
return 0;
}
On 8/31/2012 8:30 AM, Matthew Chambers wrote:
GetLabelData and GetNoiseData are in IXRawfile2, so you don't need to
go all the way up to 5 unless you need the even newer functions. As
for the crashes, you probably aren't initializing the input/output
parameters correctly or you haven't run SetController before the call.
You'd need to show your actual code for more help.
-Matt
On 8/30/2012 5:30 PM, Joshua G wrote:
Hi Mike,
Thanks for the quick reply. I've tried to access the latest methods
by creating an instance from
the XRawfile class using the following syntax:
MSfileReaderLib::IXRawfile5Ptr rawFile(null);
hr = rawFile.CreateInstance("MSFileReader.XRawfile.1");
When I compile, I receive an error that IXRawfile5Ptr is not within
my library. However, when I
change the syntax to:
MSfileReaderLib::IXRawfile*X*Ptr rawFile(null);
hr = rawFile.CreateInstance("MSFileReader.XRawfile.1");
(where *X *= 2-4),
I do not receive a compile time error. However, when I do try to run
the program using the
"GetLabelData" method, the exe stops working and the program
crashes. The syntax I used is
basically the same as in the MSfilereader reference manual for the
given method.
In parallel, I have tried to contact Thermo directly regarding this
issue, but I have not heard back
yet. I have very little programming experience, so any
troubleshooting suggestions are welcome.
Thanks!
Josh
On Monday, August 27, 2012 5:01:48 PM UTC-5, Michael Hoopmann wrote:
Hi Josh,
Not all the methods are in the old interface. You need to access the
latest methods from IXRawfile5. A good example of how to use this
interface is in
https://proteowizard.svn.sourceforge.net/svnroot/proteowizard/trunk/pwiz/pwiz_aux/msrc/utility/vendor_api/thermo/RawFile.cpp
<https://proteowizard.svn.sourceforge.net/svnroot/proteowizard/trunk/pwiz/pwiz_aux/msrc/utility/vendor_api/thermo/RawFile.cpp>
check the method: RawFileImpl::RawFileImpl(const string& filename)
It shows you how to access the most recent IXRawfile that can be
found
in your dll.
Cheers,
Mike
On 8/27/2012 2:43 PM, Joshua G wrote:
> Hi! I am tying to write a C++ program to extract Mass,
Intensity and Noise information for
each m/z measurement for a collection of scans in a RAW file from
an Orbitrap. The libraries
and documentation are provided through the following link:
http://sjsupport.thermofinnigan.com/public/detail.asp?id=703
<http://sjsupport.thermofinnigan.com/public/detail.asp?id=703>
>
> I was able to write code that could use various methods
provided in the library (such as
Open, Close, GetMassListfromScanNum), but when I try use the
methods I need (GetLabelData &
GetNoiseData for example), I receive a compile time error that
says "[Insert_Method] is not a
member of "MSFileReader::IXRawfile'."
>
> The only difference I have been able to distinguish between
the methods recognized as members
and those not is explained in the xrawfile2.tlh file. All
methods that work are within the
IXRawFile2:IDispach scope while those that do not are in
IXRawfile2:IXRawfile scope.
>
> Because there seems to be little documentation on this type of
troubleshooting with
MSfileReader, I figured I would contact those who have actually
worked with it. If anyone has
any suggestions on what to do or who to contact I would greatly
appreciate it! Additionally, if
anyone would like to look at the code itself, I would be happy to
pass that along as well per
request.
>
> Thanks,
> Josh
>
--
You received this message because you are subscribed to the Google
Groups "spctools-discuss" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/spctools-discuss/-/nCp3Sx4LcvoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/spctools-discuss?hl=en.
--
You received this message because you are subscribed to the Google Groups
"spctools-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/spctools-discuss?hl=en.