SVN r647
SVN-Revision: r647
This commit is contained in:
@@ -162,7 +162,7 @@ namespace Lskj.Main.Model
|
||||
LockApplication();
|
||||
if (_frmMain != null)
|
||||
{
|
||||
if (ERPInfo.Instance.WatermarkForm != null)
|
||||
if (ERPInfo.Instance.WatermarkForm != null)
|
||||
{
|
||||
ERPInfo.Instance.WatermarkForm.Close();
|
||||
ERPInfo.Instance.WatermarkForm.Dispose();
|
||||
@@ -293,7 +293,82 @@ namespace Lskj.Main.Model
|
||||
{
|
||||
//WinHelper.WinExec(File.Exists(dllName) ? dllName : PubUtil.AbsolutelyLibPath + dllName, 1);
|
||||
// WinHelper.WinExec(dllName);
|
||||
Process.Start(File.Exists(dllName) ? dllName : PubUtil.AbsolutelyLibPath + dllName, string.Join(",", args));
|
||||
string[] dllNameSplit = dllName.Split(',');
|
||||
if (dllNameSplit.Length > 1 && dllNameSplit[1].Equals("1"))//嵌入exe模块
|
||||
{
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
XtraTabPage tp = new XtraTabPage();
|
||||
ProcessStartInfo processStartInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = dllNameSplit[0],
|
||||
Arguments = HandleHelper.CombineArgs(args),
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = false,
|
||||
RedirectStandardError = false,
|
||||
CreateNoWindow = false
|
||||
};
|
||||
Process startedProcess = Process.Start(processStartInfo);
|
||||
if (startedProcess == null)
|
||||
{
|
||||
MessageUtil.Show("进程启动失败");
|
||||
return;
|
||||
}
|
||||
startedProcess.WaitForInputIdle();
|
||||
int retry = 0;
|
||||
while (startedProcess.MainWindowHandle == IntPtr.Zero && retry < 50)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
startedProcess.Refresh();
|
||||
retry++;
|
||||
}
|
||||
IntPtr exeMainHandle = startedProcess.MainWindowHandle;
|
||||
if (exeMainHandle == IntPtr.Zero)
|
||||
{
|
||||
MessageBox.Show("无法获取启动程序的主窗口句柄");
|
||||
return;
|
||||
}
|
||||
const int GWL_STYLE = -16;
|
||||
const int WS_BORDER = 0x00800000;
|
||||
const int WS_DLGFRAME = 0x00400000;
|
||||
const int WS_CAPTION = WS_BORDER | WS_DLGFRAME;
|
||||
const int WS_THICKFRAME = 0x00040000;
|
||||
const int WS_MINIMIZE = 0x20000000;
|
||||
const int WS_MAXIMIZEBOX = 0x00010000;
|
||||
const int WS_SYSMENU = 0x00080000;
|
||||
const int SWP_NOZORDER = 0x0004;
|
||||
const int SWP_NOACTIVATE = 0x0010;
|
||||
const uint SWP_FRAMECHANGED = 0x0020;
|
||||
// 移除窗口边框和标题栏
|
||||
int style = HandleHelper.GetWindowLong(exeMainHandle, GWL_STYLE);
|
||||
style &= ~WS_CAPTION;
|
||||
style &= ~WS_THICKFRAME;
|
||||
style &= ~WS_MINIMIZE;
|
||||
style &= ~WS_MAXIMIZEBOX;
|
||||
style &= ~WS_SYSMENU;
|
||||
HandleHelper.SetWindowLong(exeMainHandle, GWL_STYLE, style);
|
||||
// 使样式更新生效
|
||||
HandleHelper.SetWindowPos(exeMainHandle, IntPtr.Zero, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
|
||||
// 将exe窗口设置为panel的子窗口
|
||||
HandleHelper.SetParent(exeMainHandle, tp.Handle);
|
||||
// 调整大小填充panel
|
||||
HandleHelper.ResizeEmbeddedWindow(exeMainHandle, tp);
|
||||
// 自动响应panel大小变化调整嵌入窗口大小
|
||||
tp.Resize += (s, e) => HandleHelper.ResizeEmbeddedWindow(exeMainHandle, tp);
|
||||
tp.Text = module.Name;
|
||||
tp.Tag = guid;
|
||||
tp.AutoScroll = true;
|
||||
tp.ShowCloseButton = DefaultBoolean.True;
|
||||
tp.Dock = DockStyle.Fill;
|
||||
module.Tag = guid;
|
||||
module.ModuleInPtr = exeMainHandle;
|
||||
TabMain.TabPages.Add(tp);
|
||||
TabMain.SelectedTabPage = tp;
|
||||
ModuleForms.Add(guid, module);
|
||||
}
|
||||
else//直接打开exe模块
|
||||
{
|
||||
Process.Start(File.Exists(dllNameSplit[0]) ? dllNameSplit[0] : PubUtil.AbsolutelyLibPath + dllNameSplit[0], string.Join(",", args));
|
||||
}
|
||||
}
|
||||
else if (dllName.ToLower().IndexOf("http:", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||
dllName.ToLower().IndexOf("www.", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||
@@ -925,30 +1000,4 @@ namespace Lskj.Main.Model
|
||||
/// <summary>
|
||||
/// 锁定程序
|
||||
/// </summary>
|
||||
private static void LockApplication()
|
||||
{
|
||||
Thread thread = new Thread(() =>
|
||||
{
|
||||
while (SystemInfo.Instance.AwaitTime > 10)
|
||||
{
|
||||
if (isAwaitTime == SystemInfo.Instance.AwaitTime)
|
||||
{
|
||||
isAwaitTime = 0;
|
||||
if (_frmMain != null && _frmMain.Visible == true)
|
||||
{
|
||||
_frmMain.Invoke(new Action(() =>
|
||||
{
|
||||
_frmMain.mainPanelControlEx.AwaitControl.BringToFront();
|
||||
_frmMain.mainPanelControlEx.AwaitControl.Visible = true;
|
||||
_frmMain.mainPanelControlEx.AwaitControl.OnFrmAwaitScreenLoad();
|
||||
}));
|
||||
}
|
||||
}
|
||||
isAwaitTime += 1;
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
});
|
||||
thread.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void Loc
|
||||
Reference in New Issue
Block a user