ShellExecute的 [英] ShellExecute

查看:111
本文介绍了ShellExecute的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好 

我想在窗体中使用  ShellExecute()函数。 

I want to use ShellExecute() function in the window forms. 

字符串^ base_url =" https://www.google.com/search?q =" ;;

String ^ search_url;

search_url = base_url + box-> Text;

        ShellExecute(NULL,"open",search_url,NULL,NULL,SW_SHOW);

String^ base_url = "https://www.google.com/search?q=";
String^ search_url;
search_url = base_url + box->Text;
        ShellExecute(NULL, "open", search_url, NULL, NULL, SW_SHOW);

但是这里search_url必须是数据类型LPCSTR。

but here search_url have must in the datatype LPCSTR.

怎么能解决这个问题?

推荐答案

其中一种方法是
Marshal :: StringToHGlobalUni

但您也可以使用方便的替代方法调用
ShelExecute

using namespace System::Diagnostics; Process p; p.StartInfo->UseShellExecute = true; p.StartInfo->Verb = "open"; p.StartInfo->FileName = search_url;
p.StartInfo->WindowStyle = ProcessWindowStyle::Normal;
p.Start();











这篇关于ShellExecute的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆