Results 1 to 7 of 7

Thread: Help - how to embed external program into a form?

  1. #1
    Join Date
    Jan 2006

    Help - how to embed external program into a form?

    I would like to ask is there an article on how to embed an external application into a window form like centrafuse or skinbedder. Any help is apreciated. thanks.

  2. #2
    Join Date
    Mar 2005
    Which language?

  3. #3
    Join Date
    Mar 2005
    ... ops

    have you tried with SetParent

  4. #4
    Join Date
    Jan 2006
    thanks for the reply, i figured it out for c# framework. now i just need to remove all those title bar. Thanks again.

  5. #5
    Join Date
    Jan 2007

    How did you do it?

    I am trying to do the same thing at no avail.

    How did you embed an external program into a C# windows Form?

    Thanks in advance

  6. #6
    Constant Bitrate
    Join Date
    Aug 2002
    Eau Claire, Wi
    I am also interested in a basic example or a guide for embedding external apps. This is something new to me and i don't really know where to start. Specifically, c# examples would be great. But, any .net language will do.
    System: AMD Duron 1200+ , 512 MB ram , usb sb mp3+ , Tview 7" touchscreen , M1-ATX PSU , Slot Load iMac DVD-Rom , 40 GB laptop HDD, netgear USB 802.11g

    Progress: Installation: 90% Dash fabrication: 80%

    Parts Needed: USB GPS

  7. #7
    Join Date
    May 2007
    Copy and Pasted from my C# FrontEnd project (with it doing notepad but iguidanceumpc works as well)
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.Diagnostics;
    using System.Runtime.InteropServices;
    namespace CarPC
        public partial class MainForm
    #region Methods/Consts for Embedding a Window
            [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);
            static extern int SetWindowLong(IntPtr hWnd, int nIndex, int 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, int wParam, int 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 = 0x10000000;
            private const int WM_CLOSE = 0x10;
            private const int WS_CHILD = 0x40000000;
            private const int WS_MAXIMIZE = 0x01000000;
            #region Variables
            private Panel gpsPanel;
            private IntPtr gpsHandle;
            private Process gpsProcess = null;
            private ProcessStartInfo gpsPSI = new ProcessStartInfo();
            private void SetupGPSPanel()
                //Panel to Contain Controls
                this.gpsPanel = new Panel();
                this.gpsPanel.Location = new Point(this.LeftBarRight, this.TopBarBottom);
                this.gpsPanel.Size = new Size(this.Size.Width - this.LeftBarRight, this.Size.Height - this.TopBarBottom);
                this.gpsPanel.Visible = false;
                gpsPSI.FileName = "notepad.exe";
                gpsPSI.Arguments = "";
                gpsPSI.WindowStyle = ProcessWindowStyle.Maximized;
                gpsProcess = System.Diagnostics.Process.Start(gpsPSI);
                gpsHandle = gpsProcess.MainWindowHandle;
                SetParent(gpsHandle, this.gpsPanel.Handle);
                SetWindowLong(gpsHandle, GWL_STYLE, WS_VISIBLE + WS_MAXIMIZE);
                MoveWindow(gpsHandle, 0,0, this.gpsPanel.Width, this.gpsPanel.Height, true);
    If using iguidance in particular, for arguments make sure to put the nowarning part in.

Similar Threads

  1. Neocar External Application Bug Fix!
    By reddeath30 in forum NeoCar Media Center
    Replies: 10
    Last Post: 04-07-2005, 08:25 AM
  2. Replies: 10
    Last Post: 01-21-2005, 04:27 PM
  3. Problems with VB program as external app
    By zolakk in forum ME Archive
    Replies: 3
    Last Post: 07-09-2003, 10:36 PM
  4. More than one external application?
    By KlereBak in forum ME Archive
    Replies: 2
    Last Post: 02-12-2003, 07:31 PM
  5. Running a program inside a program
    By CaffeineAddict in forum Software & Software Development
    Replies: 10
    Last Post: 10-16-2002, 03:26 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts