QString to LPCTSTR conversion
HI All
I am using win32 dll in my QT Qt Application.
win32 dll has one function which takes parameter of type LPCTSTR.
When i try to call this function from my Qt Application passing QString as parameter function is not recieveng the correct value .
How to resolve this?
4 replies
Try QString::toWCharArray() [doc.qt.nokia.com].
If it is a pure in parameter, you can try:
- void fooSub(LPSTSTR X); // this is our function :-)
- foo()
- {
- QString text;
- if(sizeof(TCHAR) == 1)
- fooSub((LPCSTR)text.toLocal8Bit().constData()); // here you have to check, how to convert, you could also use utf8(), ...
- else
- fooSub((LPCWSTR)text.utf16());
- }
You must log in to post a reply. Not a member yet? Register here!



