<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QString to LPCTSTR conversion]]></title><description><![CDATA[<p dir="auto">HI All</p>
<p dir="auto">I am using win32 dll in my -QT- Qt Application.<br />
win32 dll has one function which takes parameter of type LPCTSTR.<br />
When i try to call this function from my Qt Application passing QString as parameter function is not recieveng the correct value .<br />
How to resolve this?</p>
]]></description><link>https://forum.qt.io/topic/11818/qstring-to-lpctstr-conversion</link><generator>RSS for Node</generator><lastBuildDate>Sat, 06 Jun 2026 19:38:12 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/11818.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 01 Dec 2011 09:36:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QString to LPCTSTR conversion on Thu, 01 Dec 2011 22:19:02 GMT]]></title><description><![CDATA[<p dir="auto">If it is a pure in parameter, you can try:</p>
<p dir="auto">@<br />
void fooSub(LPSTSTR X); // this is our function :-)</p>
<p dir="auto">foo()<br />
{<br />
QString text;<br />
if(sizeof(TCHAR) == 1)<br />
fooSub((LPCSTR)text.toLocal8Bit().constData()); // here you have to check, how to convert, you could also use utf8(), ...<br />
else<br />
fooSub((LPCWSTR)text.utf16());<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/post/118917</link><guid isPermaLink="true">https://forum.qt.io/post/118917</guid><dc:creator><![CDATA[giesbert]]></dc:creator><pubDate>Thu, 01 Dec 2011 22:19:02 GMT</pubDate></item><item><title><![CDATA[Reply to QString to LPCTSTR conversion on Thu, 01 Dec 2011 17:24:03 GMT]]></title><description><![CDATA[<p dir="auto">Try "QString::toWCharArray() ":<a href="http://doc.qt.nokia.com/4.7/qstring.html#toWCharArray" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.nokia.com/4.7/qstring.html#toWCharArray</a>.</p>
]]></description><link>https://forum.qt.io/post/118893</link><guid isPermaLink="true">https://forum.qt.io/post/118893</guid><dc:creator><![CDATA[goetz]]></dc:creator><pubDate>Thu, 01 Dec 2011 17:24:03 GMT</pubDate></item><item><title><![CDATA[Reply to QString to LPCTSTR conversion on Thu, 01 Dec 2011 17:17:57 GMT]]></title><description><![CDATA[<p dir="auto">LPCTSTR = Long Pointer to a Const TCHAR STRing<br />
(const char*)</p>
<p dir="auto">Try the simple casting.</p>
]]></description><link>https://forum.qt.io/post/118892</link><guid isPermaLink="true">https://forum.qt.io/post/118892</guid><dc:creator><![CDATA[broadpeak]]></dc:creator><pubDate>Thu, 01 Dec 2011 17:17:57 GMT</pubDate></item><item><title><![CDATA[Reply to QString to LPCTSTR conversion on Thu, 01 Dec 2011 10:15:32 GMT]]></title><description><![CDATA[<p dir="auto">Which compiler are you using?<br />
How did you perform the conversion?</p>
]]></description><link>https://forum.qt.io/post/118827</link><guid isPermaLink="true">https://forum.qt.io/post/118827</guid><dc:creator><![CDATA[koahnig]]></dc:creator><pubDate>Thu, 01 Dec 2011 10:15:32 GMT</pubDate></item></channel></rss>