Using COM dll in a Qt project
In vs c++ I used the following code to use some functions in a dll file that I don't have its header
开发者_运维问答#import "dll path"
HRESULT hr = CoInitialize(NULL);
if (hr==S_OK)
{cout<<"INITIALIZED\n";}
Trans_ATLLib::ITransCriptPtr Trans;
hr = Trans.CreateInstance(__uuidof(Trans_ATLLib::TransCript));
if (hr==S_OK)
{cout<<"INSTANCE CREATED\n";}
hr =Trans->EnableLastCharTashkeel(true);
if (hr==S_OK)
{cout<<"EnableLastCharTashkeel DONE\n";}
hr =Trans->EnableEmphaticLAM_RAA(true);
if (hr==S_OK)
{cout<<"EnableEmphaticLAM_RAA DONE\n";}
VARIANT_BOOL test;
test = Trans->SetText(arabic_string);
if (test==0)
{cout<<"error in setting the arabic sting\n";}
string result;
result = Trans->GetResult();
istringstream iss(result);
vector<string> phonemes;
copy(istream_iterator<string>(iss),istream_iterator<string>(),back_inserter<vector<string> >(phonemes));
return phonemes;
}
But I found that Qt doesn't use the same method.
Can any one help me in calling these functions in Qt?
Thanks in advance.
If you use c++ - do the same! Qt is a set of libraries, not a different programming language - call to winApi everywhere you need, but don't forget that it is not portable.
精彩评论