wpf Load exe program, embed exe program, hide title, etc.

Key code

 IntPtr notepadHandle =APPIntprt= _process.MainWindowHandle;
            int style = GetWindowLong(notepadHandle, GWL_STYLE);
            style = style & ~((int)WS_CAPTION) & ~((int)WS_THICKFRAME); // Removes Caption bar and the sizing border
            style |= ((int)WS_CHILD); // Must be a child window to be hosted

            SetWindowLong(notepadHandle, GWL_STYLE, style);
            SetParent(notepadHandle, this.Handle);

 

Effect picture (embedded Notepad process exe):

 

 Source code download:

https://files.cnblogs.com/files/chlm/wpf_load_exe.rar

 

Guess you like

Origin www.cnblogs.com/chlm/p/12726279.html