Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regardiing faq184-2555 by wgcs 3rd Party Apps in VFP 2

Status
Not open for further replies.

xBaseDude

MIS
Jan 31, 2002
357
US
Still new to the concept of OLE automation, I have been working with faq184-2555 How do I get a third-party application window toappear inside VFP instead of in the Windows desktop? Kindly shared by wgcs.

I have cut and pasted the following code both in a prg and the Init event of a Form

Code:
* Example use:
oWrd = createobject('word.application')
oWrd.height = _screen.height/2
oWrd.width  = _screen.width/2
oWrd.top    = _screen.height/8
oWrd.left   = _screen.width/8
res = takewindow(oWrd.caption) oWrd.visible = .t.

Each time the program has crashed at the line...

oWrd.height = _screen.height/2

With the err msg...

OLEIDispatch exception code 0 from Microsft Word:'Height is not a reference property..."

I am unclear on what the error message is telling me, and how I resolve this issue.

The Word EXE kicks off fine, but appears in the system tray at the bottom of the Windows desktop.

My environment is VFP 70 SP1 on WinXP. Word is the 2000 version.

TIA - Wayne




 
Just to jump in....

It is not really exlained to the reader what is done with res = takewindow(oWrd.caption). I follow the method and see that res is returning a numeric value of -1, but I am clueless as to what this value should be used for.

Mike said:
Takewindow seems to be a function to make whatever window name is passed as a parameter the top-most window.


The purpose of "TakeWindow" is to take a window that is a "top level" window, and make it a Child Window inside either the VFP main window, or a VFP child window. This can make an application like MS Word or Internet Explorer look and act as though it is part of your application.

This doesn't provide any hooks (as you've noticed) for when the user might close that other application.


There is a way to remove the controls, but I don't know it offhand. Inside TakeWindow is code to get the window handle to the WOrd or IE window. With that window handle, you can do just about anything you want, using the correct WinAPI calls.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top