关键代码
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);
效果图(嵌入记事本进程exe):
源码下载:
https://files.cnblogs.com/files/chlm/wpf_load_exe.rar