如何使用ShellExecute打开IE窗体,要求是在新窗体中打开,非原来IE窗体。顶者有分!

khkhing 2005-03-08 11:07:43
如何使用ShellExecute打开IE窗体,要求是在新窗体中打开,非原来IE窗体。
现使用的打开方式每次都在已有窗体中打开,挺烦人的,希望在新创建一个IE窗体进行打开网址。
...全文
501 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
khkhing 2005-03-17
  • 打赏
  • 举报
回复
近来较忙,结贴的时间搁了些时间,抱歉。
g961681 2005-03-08
  • 打赏
  • 举报
回复
收藏
senfore 2005-03-08
  • 打赏
  • 举报
回复
好呀,收藏了
cdsgajxlp 2005-03-08
  • 打赏
  • 举报
回复
深入浅出ShellExecute
Q: 如何打开一个应用程序?

ShellExecute(this->m_hWnd,"open","calc.exe","","", SW_SHOW );



ShellExecute(this->m_hWnd,"open","notepad.exe",

"c:\MyLog.log","",SW_SHOW );



Q: 如何打开一个同系统程序相关连的文档?

ShellExecute(this->m_hWnd,"open",

"c:\abc.txt","","",SW_SHOW );


Q: 如何打开一个网页?

ShellExecute(this->m_hWnd,"open","http://www.google.com";,"","", SW_SHOW );


Q: 如何激活相关程序,发送EMAIL?

ShellExecute(this->m_hWnd,"open",

"mailto:nishinapp@yahoo.com","","", SW_SHOW );


Q: 如何用系统打印机打印文档?

ShellExecute(this->m_hWnd,"print",

"c:\abc.txt","","", SW_HIDE);


Q: 如何用系统查找功能来查找指定文件?

ShellExecute(m_hWnd,"find","d:\nish",

NULL,NULL,SW_SHOW);


Q: 如何启动一个程序,直到它运行结束?

SHELLEXECUTEINFO ShExecInfo = {0};

ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);

ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;

ShExecInfo.hwnd = NULL;

ShExecInfo.lpVerb = NULL;

ShExecInfo.lpFile = "c:\MyProgram.exe";

ShExecInfo.lpParameters = "";

ShExecInfo.lpDirectory = NULL;

ShExecInfo.nShow = SW_SHOW;

ShExecInfo.hInstApp = NULL;

ShellExecuteEx(&ShExecInfo);

WaitForSingleObject(ShExecInfo.hProcess,INFINITE);

或:

PROCESS_INFORMATION ProcessInfo;

STARTUPINFO StartupInfo; //入口参数

ZeroMemory(&StartupInfo, sizeof(StartupInfo));

StartupInfo.cb = sizeof StartupInfo ; //分配大小

if(CreateProcess("c:\winnt\notepad.exe", NULL,

NULL,NULL,FALSE,0,NULL,

NULL,&StartupInfo,&ProcessInfo))

{

WaitForSingleObject(ProcessInfo.hProcess,INFINITE);

CloseHandle(ProcessInfo.hThread);

CloseHandle(ProcessInfo.hProcess);

}

else

{

MessageBox("The process could not be started...");

}



Q: 如何显示文件或文件夹的属性?

SHELLEXECUTEINFO ShExecInfo ={0};

ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);

ShExecInfo.fMask = SEE_MASK_INVOKEIDLIST ;

ShExecInfo.hwnd = NULL;

ShExecInfo.lpVerb = "properties";

ShExecInfo.lpFile = "c:\"; //也可以是文件

ShExecInfo.lpParameters = "";

ShExecInfo.lpDirectory = NULL;

ShExecInfo.nShow = SW_SHOW;

ShExecInfo.hInstApp = NULL;

ShellExecuteEx(&ShExecInfo);
海天候 2005-03-08
  • 打赏
  • 举报
回复
ShellExecute(Handle,'open',PChar('explorer'),'http://www.csdn.net',nil,SW_SHOW);
一定要加"http://",呵呵
这样就可以弹出另外的浏览器窗口.
海天候 2005-03-08
  • 打赏
  • 举报
回复
ShellExecute(Handle,'open',PChar('explorer'),'www.csdn.net',nil,SW_SHOW);
todouwang 2005-03-08
  • 打赏
  • 举报
回复
jf
78hgdong 2005-03-08
  • 打赏
  • 举报
回复
楼上D.
gzmhero 2005-03-08
  • 打赏
  • 举报
回复
ShellExecute(Handle,'open',PChar('C:\Program Files\Internet Explorer\IEXPLORE.EXE'),'www.csdn.net',nil,SW_SHOW);
khkhing 2005-03-08
  • 打赏
  • 举报
回复
问题已经得到解决,将很快结贴。

俺还有另一个问题的贴子已经搁了好长时间,有劳帮忙顶一下,顶者也有分,拜托了。
http://community.csdn.net/Expert/TopicView.asp?id=3722948
(1) 这个控件叫INET控件 INET控件的几点使用 Inet控件支持HTTP与FTP两种通讯协议。利用这个控件可以完成许多功能。 我们通过例子来看看。 环境VB6+WINXP 打开VB6,建工程 添加部件Microsoft Internet Transfer Controls. 在form添加2个按钮,2个文本框和Inet控件 代码如下: Option Explicit ''这段代码使用了GetHeader来返回页面信息,比较准确一些 ''可以得到文件最后修改日期,文件大小等等 ''用这个办法还可以判断一个文件是否存在 Private Sub Command1_Click() Dim a As String Dim str As String Dim RetCode As Long Inet1.OpenURL "http://localhost/xml/tt.htm" If Inet1.StillExecuting Then DoEvents End If ''可以看到所有的项目 MsgBox Inet1.GetHeader ''得到修改日期时间是格林时间,将它转换北京时间 str = Inet1.GetHeader("Last-modified") str = Replace(Right(str, Len(str) - InStr(1, str, ",") - 1), "GMT", "") Text1.Text = CDate(Format(str, "yyyy/mm/dd hh:mm:ss")) MsgBox Inet1.GetHeader("content-length") RetCode = Val(Mid(Trim(Inet1.GetHeader), 10, 3)) Select Case RetCode Case 200 MsgBox "成功" Case 404 MsgBox "没有发现" Case Else MsgBox "Error" End Select End Sub ''这段代码简单的判断了是否与internet连接 ''如果连接,得到网页源码并且保存 Private Sub Command2_Click() Inet1.Cancel If Len(Inet1.OpenURL("http://localhost/xml\tt.htm")) 0 Then MsgBox "已经连接" Text2.Text = Inet1.OpenURL("http://localhost/xml\tt.htm") If Inet1.StillExecuting Then DoEvents End If ''保存到文件 Open App.Path & "\index.htm" For Output As #1 Print #1, Text2.Text Close #1 Else MsgBox "没有连接" End If End Sub. (2) '我最喜欢用这种方法 Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private Sub Command1_Click() Dim WEBADDR As String WEBADDR = "http://www.baidu.com/" Call ShellExecute(hwnd, "Open", WEBADDR, "", App.Path, 3) End Sub '另两种方法 Private Sub Command1_Click() aa = "Explorer http://www.baidu.com/" Shell aa, vbNormalFocus End Sub '******************************* Private Sub Command1_Click() WebBrowser1.Navigate ("http://www.baidu.com/") End Sub

5,928

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧