C#如何以模态方式c 打开exe程序序

C# 程序调用外部exe,并操作
[问题点数:80分,结帖人sanye8879cd]
本版专家分:0
结帖率 91.67%
CSDN今日推荐
本版专家分:9243
本版专家分:0
结帖率 91.67%
本版专家分:9243
本版专家分:18109
2012年6月 总版技术专家分月排行榜第一
2012年6月 .NET技术大版内专家分月排行榜第一
本版专家分:0
结帖率 91.67%
本版专家分:0
结帖率 91.67%
本版专家分:0
结帖率 91.67%
本版专家分:18109
2012年6月 总版技术专家分月排行榜第一
2012年6月 .NET技术大版内专家分月排行榜第一
本版专家分:0
结帖率 91.67%
本版专家分:9243
本版专家分:0
结帖率 91.67%
本版专家分:9243
本版专家分:0
结帖率 91.67%
本版专家分:27417
2018年2月 总版技术专家分月排行榜第二
2018年2月 .NET技术大版内专家分月排行榜第一
2018年1月 .NET技术大版内专家分月排行榜第二
本版专家分:0
结帖率 91.67%
匿名用户不能发表回复!|
CSDN今日推荐新手求助。怎样在模态对话框里通过点击按钮的方式打开新窗口?【c#吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:120,739贴子:
新手求助。怎样在模态对话框里通过点击按钮的方式打开新窗口?收藏
如图,2月份需要通过打开另一个窗口并重新计算一下,然后输出2月有多少天。老师还没上到这,纯粹个人想提前了解一下,应该怎么写代码。希望各位大神多多帮忙啊!
c#教程,博为峰IT培训免费试听,0元入学,现在更有多重优惠,仅限今天!博为峰,真正的为年轻人服务的企业,14年间培训15万余名it工程师,成绩斐然!
你是想在点击“OK”按钮后隐藏Form1 ,显示Form2吗?
if(MessageBox.Show(&2月份比较特殊,需要输入年份&,“$_$”,MessageBoxButtons.Ok,MessageBoxIcon.Warning)==DiaLogResult.Ok){Form2 frm2=new Frm2();this.Hide();frm2.Show();}
前面要不要加命名空间什么的,我新手,还望赐教
登录百度帐号posts - 248,&
comments - 72,&
trackbacks - 0
今天遇到一个问题,C#程序要调用外部一个EXE文件,并且调用完毕后紧接着执行下面的一段代码,从网上查询,
如果只是简单的调用外部的EXE程序文件,只需要下面一行代码就可以搞定。
&&&&&&&&&&&&&&& System.Diagnostics.Process.Start(Application.StartupPath + &你的应用程序.exe&);
如果是等待这个EXE程序执行完毕再执行下面的代码其实也是很简单的,只需要在后面使用WaitForExit()方法即可。
代码如下System.Diagnostics.Process.Start(Application.StartupPath + &你的应用程序.exe&).WaitForExit();
是不是很简单呢,呵呵。
阅读(...) 评论()C#将exe运行程序嵌入到自己的winform窗体中 - 快乐家++ - 博客园
posts - 244, comments - 168, trackbacks - 0, articles - 14
以下例子是将Word打开,然后将它嵌入到winform窗体中,效果如下图:C将exe运行程序嵌入到自己的winform窗体中 - kingmax_res - iSport注意:该方法只适用于com的exe(如word,Excel之类),.net的编的exe就不能用这用方法嵌入到窗体中。
using System.Collections.G
using System.ComponentM
using System.D
using System.D
using System.T
using System.Windows.F
using System.D
using System.Runtime.InteropS
namespace WindowsTest
public partial class Form2 : Form
Process process =
IntPtr appW
private string exeName = "";
[DllImport("user32.dll", EntryPoint = "GetWindowThreadProcessId", SetLastError = true,
CharSet = CharSet.Unicode, ExactSpelling = true,
CallingConvention = CallingConvention.StdCall)]
private static extern long GetWindowThreadProcessId(long hWnd, long lpdwProcessId);
[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", SetLastError = true)]
private static extern long SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll", EntryPoint = "GetWindowLongA", SetLastError = true)]
private static extern long GetWindowLong(IntPtr hwnd, int nIndex);
[DllImport("user32.dll", EntryPoint = "SetWindowLongA", SetLastError = true)]
private static extern long SetWindowLong(IntPtr hwnd, int nIndex, long dwNewLong);
//private static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
[DllImport("user32.dll", SetLastError = true)]
private static extern long SetWindowPos(IntPtr hwnd, long hWndInsertAfter, long x, long y, long cx, long cy, long wFlags);
[DllImport("user32.dll", SetLastError = true)]
private static extern bool MoveWindow(IntPtr hwnd, int x, int y, int cx, int cy, bool repaint);
[DllImport("user32.dll", EntryPoint = "PostMessageA", SetLastError = true)]
private static extern bool PostMessage(IntPtr hwnd, uint Msg, long wParam, long lParam);
private const int SWP_NOOWNERZORDER = 0x200;
private const int SWP_NOREDRAW = 0x8;
private const int SWP_NOZORDER = 0x4;
private const int SWP_SHOWWINDOW = 0x0040;
private const int WS_EX_MDICHILD = 0x40;
private const int SWP_FRAMECHANGED = 0x20;
private const int SWP_NOACTIVATE = 0x10;
private const int SWP_ASYNCWINDOWPOS = 0x4000;
private const int SWP_NOMOVE = 0x2;
private const int SWP_NOSIZE = 0x1;
private const int GWL_STYLE = (-16);
private const int WS_VISIBLE = 0x;
private const int WM_CLOSE = 0x10;
private const int WS_CHILD = 0x;
public string ExeName
return exeN
public Form2()
InitializeComponent();
private void button1_Click(object sender, EventArgs e)
this.exeName = @"D:\Program Files\Microsoft Office\OFFICE11\WINWORD.exe";
// Start the process
process = System.Diagnostics.Process.Start(this.exeName);
// Wait for process to be created and enter idle condition
process.WaitForInputIdle();
// Get the main handle
appWin = process.MainWindowH
catch (Exception ex)
MessageBox.Show(this, ex.Message, "Error");
// Put it into this form
SetParent(appWin, this.Handle);
// Remove border and whatnot
// SetWindowLong(appWin, GWL_STYLE, WS_VISIBLE);
// Move the window to overlay it on this window
MoveWindow(appWin, 0, 0, this.Width, this.Height, true);
private void Form2_FormClosed(object sender, FormClosedEventArgs e)
process.Kill();
private void Form2_Resize(object sender, EventArgs e)
if (this.appWin != IntPtr.Zero)
MoveWindow(appWin, 0, 0, this.Width, this.Height, true);
//base.OnResize(e);利用javascript打开模态对话框(示例代码)
转载 &更新时间:日 09:40:58 & 作者:
本篇文章主要是对利用javascript打开模态对话框的示例代码进行了介绍,需要的朋友可以过来参考下,希望对大家有所帮助
1. 标准的方法 代码如下:&script type="text/javascript"&&& function openWin(src, width, height, showScroll){&& window.showModalDialog (src,"","location:No;status:No;help:No;dialogWidth:"+width+";dialogHeight:"+height+";scroll:"+showScroll+";");&& }&& &/script&& 例:&span style="CURSOR: pointer" onclick="openWin& ('//www.jb51.net', '500px', '400px', 'no')"&点击&/span&&
2. 要注意的是,Firefox并不支持该功能,它支持的语法是
window.open& ('openwin.html','newWin', 'modal=yes, width=200,height=200,resizable=no, scrollbars=no' );&
3. 如何自动判断浏览器
代码如下:&input type="button" value="打开对话框" onclick="showDialog('#')"/&& & &SCRIPT&& LANGUAGE="JavaScript"&& & &!--& & function&& showDialog(url)& & {& && if(&& document.all&& ) //IE& && {& && feature="dialogWidth:300dialogHeight:200status:help:no";& && window.showModalDialog(url,null,feature);& && }& && else& && {& &&&& //modelessDialog可以将modal换成dialog=yes& && feature ="width=300,height=200,menubar=no,toolbar=no,location=no,";& && feature+="scrollbars=no,status=no,modal=yes";&&& && window.open(url,null,feature);& && }& & }& & //--&& &/SCRIPT& 4. 在IE中,模态对话框会隐藏地址栏,而在其他浏览器则不一定
【注意】在谷歌浏览器中,这个模态的效果也会失效。
5. 一般在弹出对话框的时候,我们都希望整个父页面的背景变为一个半透明的颜色,让用户看到后面是不可以访问的
而关闭对话框之后又希望还原
这是怎么做到的呢? 代码如下:&&&&&&& ///显示某个订单的详细信息,通过一个模态对话框,而且屏幕会变颜色&&&&&&& function ShowOrderDetails(orderId) {&&&&&&&&&&& var url = "details.aspx?orderID=" + orderId;
//&&&&&&&&&&& $("body").css("filter", "Alpha(Opacity=20)");&&&&&&&&&&& //filter:Alpha(Opacity=50)
&&&&&&&&&&& $("body").addClass("body1");
&&&&&&&&&&& ShowDetailsDialog(url, "600px", "400px", "yes");
&&&&&&&&&&& $("body").removeClass("body1");&&&&&&& } 另外,有一个样式表定义.body1{&&& background-color:#999999;&&& filter:Alpha(Opacity=40);}
代码如下:&%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %&
&!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&
&html xmlns="http://www.w3.org/1999/xhtml" &&head runat="server"&&&& &title&&/title&&&& &style type="text/css"&&&& .body1{&&&&&&& background-color:#999999;&&&&&&& filter:Alpha(Opacity=40);&&& }&&& &/style&&&& &script src="jquery.js" type="text/javascript"&&/script&&&& &script type="text/javascript"&&&&&&&& function ShowDetailsDialog(src, width, height, showScroll) {&&&&&&&&&&& window.showModalDialog(src, "", "location:No;status:No;help:NO;dialogWidth:" + width + ";dialogHeight:" + height + ";scroll" + showScroll + ";");&&&&&&& }
&&&&&&& function ShowOrderDetails(orderId) {&&&&&&&&&&& var url = 'Details.aspx?orderID=' + orderId;&&&&&&&&&&& $("body").addClass("body1");&&&&&&&&&&& ShowDetailsDialog(url, '500px', '400px', 'no');&&&&&&&&&&& $("body").removeClass("body1");&&&&&&& }&&& &/script&&/head&&body&&&& &form id="form1" runat="server"&&&& &div&&&& &span style="cursor:pointer" onclick="ShowOrderDetails(11)" &点击&/span&&&& &/div&&&& &/form&&/body&&/html&
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具

我要回帖

更多关于 python 打开exe程序 的文章

 

随机推荐