Solved

Word as a Child in a MDI application

Posted on 2000-02-24
8
268 Views
Last Modified: 2010-05-02
Hello!
I need some help on a tough case I'm working on.
I have an MDI application, and I would like to use Word2000 as the text editor of the application. And here is the tough part: I want word to act like a child-form of the MDI-form. Is this possible? I have tryed to use the OLE container. But I was not satisfied with that, because I had to double-click it to activate it.
0
Comment
Question by:Olli083097
8 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 2553705
If you use the OLE container, you can open the document in the container using:

OLE1.DoVerb vbOLEShow

In the form_load event for example.
0
 

Author Comment

by:Olli083097
ID: 2553755
TimCottee:
Well, but this is not exactly what I want... I need the Word-menubar, toolboxes/-lines and so forth...

Bu tmost of all I would like to solve the problem without using a VB-childform...

-Olli
0
 
LVL 27

Expert Comment

by:Ark
ID: 2553806
0
 

Expert Comment

by:ravisayal
ID: 2553969
Here is a code that will make the MS-Word the Child Window of ur application window But U will have too look for other API functions  as well if U want to make it perfect. I am using MDI-FORM dbl Click event here U can use whatever U want.



Option Explicit

Private Declare Function GetMenu Lib "user32" (ByVal hWnd As Long) As Long ' hMenu
Private Declare Function SetMenu Lib "user32" (ByVal hWnd As Long, ByVal hmenu As Long) As Long 'C BOOL
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function MoveWindow Lib "user32" (ByVal hWnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long


Private Sub MDIForm_DblClick()
Dim lng_wrdwindow As Long, lng_mywindow As Long, i As Long, lng_wrdmenu, j
Dim str_windowname As String

str_windowname = "Microsoft Word - Document1"
lng_wrdwindow = FindWindow(vbNullString, str_windowname)
lng_mywindow = Me.hWnd
i = SetParent(lng_wrdwindow, lng_mywindow)
i = MoveWindow(lng_wrdwindow, 5, 10, (Me.ScaleWidth / Screen.TwipsPerPixelX) - 10, (Me.ScaleHeight / Screen.TwipsPerPixelY) - 10, -1&)
lng_wrdmenu = GetMenu(lng_wrdwindow)
j = SetMenu(lng_mywindow, lng_wrdmenu)

' the settting of menu doesnot work in case simple
' menus only not with Coolbars that Ms Word uses,
' but I wont say it is impossible, I havent tried it yet

End Sub


0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 1

Accepted Solution

by:
jelliott720 earned 200 total points
ID: 2554068
The best example I've seen of doing this is called Office Framer, which can be found at :

(http://support.microsoft.com/download/support/mslfiles/OFramer.exe)


Hope this helps..
0
 

Author Comment

by:Olli083097
ID: 2557129
jelliott720:
Awesome!!! Thanx man, this really helped! Just what I needed!

all:
Thanx for trying!

BTW: the GetWindowRect API reads the  rect of the entire MDIForm, I need the rect of only the worspace in it. What can I do about this?
0
 
LVL 27

Expert Comment

by:Ark
ID: 2557189
Hi
Workspace is child of MDIForm, Child windows are actually childs of workspace. So, use this
hWork = GetWindow(MDIForm1.hwnd, GW_CHILD)
GetWindowRect hWork, rc

Good luck
0
 

Author Comment

by:Olli083097
ID: 2557538
Ark:
Thanks, it worked!

All:
I have been tweaking on this for a few hours now, and it's getting really nice. But I still have a problem:
I have the Word window as a child (not maximized). When I click on the Word titlebar to move it, it jumps away form the mouse pointer... How do I fix this?
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now