将std:string转换为LPCTSTR [英] convert std:string to LPCTSTR
问题描述
我该怎么做?
我想打电话给以下代码:
....
string url =< my urld> ;;
TCHAR * urlParams = GetParams();
url.append((char *)urlParams);
GotoURL((LPCTSTR)url); < ------这是我的问题
....
静态BOOL GotoURL(LPCTSTR lpszUrl)
{
//尝试打开超链接
SHELLEXECUTEINFO sei;
memset(& sei,0,sizeof(SHELLEXECUTEINFO) ));
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.fMask = SEE_MASK_FLAG_NO_UI;
sei.lpVerb = _T(打开);
//sei.lpFile=_T("iexplore.exe");
sei.lpFile = lpszUrl;
sei.nShow = SW_SHOWMAXIMIZED;
//sei.lpParameters=_T("you url here");
返回ShellExecuteEx(& ; sei);
}
How can i do this?
i''d like to call the following code:
....
string url = <my urld>;
TCHAR* urlParams = GetParams( );
url.append( (char * ) urlParams );
GotoURL( ( LPCTSTR ) url ); <------THIS IS MY ISSUE
....
static BOOL GotoURL(LPCTSTR lpszUrl)
{
// Try to open hyperlink
SHELLEXECUTEINFO sei;
memset(&sei, 0, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.fMask = SEE_MASK_FLAG_NO_UI;
sei.lpVerb = _T("open");
//sei.lpFile=_T("iexplore.exe");
sei.lpFile = lpszUrl;
sei.nShow = SW_SHOWMAXIMIZED;
//sei.lpParameters=_T("you url here");
return ShellExecuteEx(&sei);
}
推荐答案
* farseer:
* farseer:
如何我可以这样做吗?
标准C ++没有一个名为LPCTSTR的类型,你没有定义它的
。 />
即,你在clc ++中没有话题了。
请将你的问题发给e。 G。 [comp.os.ms-windows.programmer.win32]。
-
答:因为它弄乱了人们通常阅读文字的顺序。
问:为什么这么糟糕?
A:热门发布。
问:什么是最烦人的事情usenet和电子邮件?
Standard C++ does not have a type called LPCTSTR, and you haven''t
defined it.
I.e., you''re off-topic in clc++.
Please post your question to e.g. [comp.os.ms-windows.programmer.win32].
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
farseer写道:
farseer wrote:
我怎么能这样做?
我'' d想调用以下代码:
How can i do this?
i''d like to call the following code:
snip incomplete,特定于平台的代码<
snip incomplete, platform-specific code<
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Luke
http://www.parashift.com/c++-faq-lit...t.html#faq-5.8
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Luke
" farseer" < FA ***** @ optonline.net>在消息中写道
news:11 ********************* @ j73g2000cwa.googlegro ups.com ...
"farseer" <fa*****@optonline.net> wrote in message
news:11*********************@j73g2000cwa.googlegro ups.com...
我该怎么做?
我想打电话给以下代码:
...
string url =< my urld> ;;
TCHAR * urlParams = GetParams();
url.append((char *)urlParams);
GotoURL((LPCTSTR)url); < ------这是我的问题
How can i do this?
i''d like to call the following code:
...
string url = <my urld>;
TCHAR* urlParams = GetParams( );
url.append( (char * ) urlParams );
GotoURL( ( LPCTSTR ) url ); <------THIS IS MY ISSUE
将定义回滚到LPCTSTR它是一个const widechar指针。
你*可能*可以使用url.c_str()这是一个const char *,但我不是
正面。试试microsoft.public.vc.language或其他Windows平台
特定组以获得明确答案,因为这个问题实际上是关闭的
主题此处(仅因为LPCTSTR是特定于Windows的)
Folling back the definition to LPCTSTR it is a const widechar pointer.
You *may* be able to use url.c_str() which is a const char*, but I''m not
positive. Try microsoft.public.vc.language or another windows platform
specific group for a definitive answer as this question is actually off
topic here (only because LPCTSTR is windows specific )
这篇关于将std:string转换为LPCTSTR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!