GAUTAM KASHYAP
6/27/2007 9:26:00 AM
Hi
I am working on a windows application develoed using .Net framework 1.1 in
VB.Net.I have a requirement where I need to open a word document in a rich
textbox control. I open a new word document ( WordApp = New
Word.ApplicationClass)
and extract the handle of this document (hWndChild = <Word
Process>.MainWindowHandle.ToInt32()). Then I extract the handle of rich
textbox ( hWndParent = <RichTextBox>.Handle.ToInt32()) and use the SetParent
method to establish a parent child relationship between the two.
The code I am using is as under
SetParent(hWndChild, hWndParent)
<DllImport("user32.dll", EntryPoint:="SetParent", _
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, _
CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function SetParent(ByVal hWndChid As Int32, ByVal hWndParent
As Int32) As Int32
End Function
My problem is when the word window opens is the rich textbox it is
minimized. I want to open the window in maximized state. I have tried
<WordApp.Documents.Open(<Path>)>.Windows.Application.WindowState = 1 but this
does not seem to work.
Also I want that the word window should not be closed or minimized
explicitly so I want to hide the tite bar of word window. Please help me in
resolving these issues.
Regards
GAUTAM KASHYAP