?
Solved

Word as a Child in a MDI application

Posted on 2000-02-24
8
Medium Priority
?
285 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 28

Expert Comment

by:Ark
ID: 2553806
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 

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
 
LVL 1

Accepted Solution

by:
jelliott720 earned 800 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 28

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

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

592 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