string xlsFileName = @"C:\Exceptions.xlsx"; private Excel.Workbook m_workbook; const int WM_SYSCOMMAND = 274; const int SC_MAXIMIZE = 61488; Process proc; [DllImport("user32.dll")] static extern int SetParent(IntPtr hWndChild, IntPtr hWndNewParent); [DllImport("user32.dll")] static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); [DllImport("ole32.dll")] static extern int GetRunningObjectTable(uint reserved, out IRunningObjectTable pprot); [DllImport("ole32.dll")] static extern int CreateBindCtx(uint reserved, out IBindCtx pctx); private void Form4_Load(object sender, EventArgs e) { //Run Notepad application inside Panel1 control proc = Process.Start(xlsFileName); proc.WaitForInputIdle(); SetParent(proc.MainWindowHandle, this.panel1.Handle); SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)