我有一个计时器,之后应该执行一个本地html文件,但是我遇到了某种错误:
int delay = 120;
delay *= CLOCKS_PER_SEC;
clock_t now = clock();
while (clock() - now < delay);
string strWebPage = "file:///D:/project/site/scam.html";
strWebPage = "file:///" + strWebPage;
ShellExecute(NULL, NULL, NULL, strWebPage, NULL, SW_SHOWNORMAL);
return 0;
E0413没有合适的转换函数从"std::string";LPCWSTR"存在
我是c++新手,所以这可能是一个明显的解决方案。
谁能告诉我怎么修理它?
你有两个问题。
但首先,您应该总是花时间阅读文档。对于Win32函数,你可以通过在你最喜欢的搜索引擎中输入"msdn ShellExecute
",然后点击"Lucky"按钮来找到一个已知的函数。
问题
ShellExecute()
是C函数。它不以std::string
为参数。它需要指向字符的指针。因此:
std::string filename = "birds.html";
INT_PTR ok = ShellExecute(
NULL, // no window
NULL, // use default operation
filename.c_str(), // file to open
NULL, // no args to executable files
NULL, // no start directory
SW_SHOWNORMAL );
if (ok <= 32)
fooey();
请注意,我们将一个const char *
传递给函数,作为相关内容
最新更新
- 在bash中查找右括号
- 密码加强脚本-如何大写第一个字母,并将整数列表追加到文件中的文本末尾,并重复列出它
- 我如何使用相同的布局为每个页面,但改变内容组件通过URL路由在Next.js?
- r语言 - 如何导入和绑定多个带有多个选项卡的Excel(名称常见)
- Jetpack Compose与Paging 3产生太多的网络请求
- 当我们设置git reset -soft时,历史记录会发生什么?
- 我们可以调用firebase作为服务器吗?
- 发送Post请求时出现启动错误,收到不支持的媒体类型415错误
- JPA继承问题与ObjectDB -字段未发现类型错误
- 插件部分中的依赖树
- 简单的GUI应用程序
- woocommerce在结帐页面上自动登录,只需使用billing_email
- X509Certificate2.Verify()运行错误,但证书正在工作
- BinanceAPIExceptionError: APIError(code=-2015): Invalid API-
- Python Scrapy代码从网站提取第一封电子邮件
- 我试图使用Plotly在python中创建一个地图图,但我的数据没有被导入或不能正常工作
- JPA储存库.save在Netty服务器channelInitializer处理程序不工作
- 通常在kafka模式注册表中注册动态protobuf模式
- 如何使用窗口提示符作为货币反应
- 如何获得光标位置悬停在GTK-rs绘图区域?
- Angular 12的数据绑定问题
- 使用Scapy和无线网卡扫描网络-网络不通错误
- Amplify GraphQL DataStore : auth rules: groupsField being ig
- Svelte自定义元素更新不工作
- 我的prinln方法没有输出我想要的相同输出
- azure function poppler utils
- r语言 - 取对角矩阵的幂
- multiplication Table in dart
- 如何捕获从装饰器抛出"FilesInterceptor"错误
- 错误:fatal:不是git存储库(或任何父目录):.git云源存储库
热门标签:
javascript python java c# php android html jquery c++ css ios sql mysql arrays asp.net json python-3.x ruby-on-rails .net sql-server django objective-c excel regex ruby linux ajax iphone xml vba spring asp.net-mvc database wordpress string postgresql wpf windows xcode bash git oracle list vb.net multithreading eclipse algorithm macos powershell visual-studio image forms numpy scala function api selenium