Solved

Word as a Child in a MDI application

Posted on 2000-02-24
8
269 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access Search and Replace Using VBA 6 72
How to debug this code 7 62
Run code from text file in vb 1 65
backup program with robocopy 6 23
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

832 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