Windows Develop Bookmark and Share   
 index > Windows Forms General > word 2007 UserControl
 

word 2007 UserControl

Hello,
I'm trying to make pseudo-word control - an UserControl that hosts Word 2007 instance window inside itself.
This is part of code i'm using:
_wordApp = new Word.Application();
_wordWnd = FindWindow("Opusapp", null);
if (_wordWnd != 0)
{
SetParent(_wordWnd, _parentControl.Handle.ToInt32());
SetWindowPos(
new IntPtr(_wordWnd),
_parentControl.Handle,
0,
0,
_parentControl.Bounds.Width,
_parentControl.Bounds.Height,
SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_DRAWFRAME
);
}
_wordApp.Visible = true;

Almost everything does fine (client area to be more precise), but non client area - title bar - is a complete mess.

Does anybody know a way how to refresh/repaint/something else this word 2007 title bar area? I've tried various Win32 API window function calls, but there was no result...

Thanks in advance!
Sergej
SergejPtr  Thursday, September 24, 2009 2:16 PM
What you are trying to do is strictly forbidden by the Windows SDK. The only reason it works is because Windows contains some appcompat hacks to support old Windows 3.x programs. Back then, making a window of another app a child of your own window wasn't a problem, Win3 didn't support threading.

But of course, Word is not a Win3 program. Not unless you use the Win3 version of it. Google DsoFramer for another approach.

Hans Passant.
nobugz  Thursday, September 24, 2009 3:54 PM
What you are trying to do is strictly forbidden by the Windows SDK. The only reason it works is because Windows contains some appcompat hacks to support old Windows 3.x programs. Back then, making a window of another app a child of your own window wasn't a problem, Win3 didn't support threading.

But of course, Word is not a Win3 program. Not unless you use the Win3 version of it. Google DsoFramer for another approach.

Hans Passant.
nobugz  Thursday, September 24, 2009 3:54 PM
tnx nobugz...!

but DsoFramer is obsolete... Microsoft does not support this ActiveX control, and it seems that there are lot of problems with latest version of DsoFramer and Office 2007...
Additionaly, I can not find link to DsoFramer on microsoft support site anymore?!?! It worked several months ago...
Iread this post yesterday:
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/de321252-b7d2-4fc9-824b-d2b665209f40
It seems that link to DsoFramer is broken???

There is no office hosting control in .NET, and all third party solutions are commercial, AFAIK...

I'm using Windows Vista, and when I switch Windows Classic theme, all this messdisappears!?






SergejPtr  Friday, September 25, 2009 8:42 AM

You can use google to search for other answers

Custom Search

More Threads

• Help Regarding Readonly property in all controls
• Order of the DocumentComplete event and the OnLoad function in webbrowser class
• using the container (member's of form1)of form1 in form2
• Drawing a checkbox within an ownerdrawn listbox
• Extending a Form with Child Controls Results in improper control positioning
• DataTable
• cannot display the usercontrol.
• RichTextBox ReadOnly = false
• Printing PDF or XLS or WORD DOC
• Accessing parent Form from a thread