>Hi Cetin,
>I posted this email to UT so everyone can benefit.
>
>
>Thank you for your response. I ran the following code:
>declare integer FindWindow in win32API string @ cClass, string @ cTitle
>
>oword = CREATEOBJECT("Word.Application")
>with oWord
> .documents.add
> .Activedocument.SaveAs('c:\My documents\A long filename word document')
> .visible = .t.
> .activate
> lcDocName = .ActiveDocument.Fullname
> if at('\',lcDocName)>0 && If has path info too
> lcDocName = substr(lcDocName,rat('\',lcDocName)+1)
> endif
> hWnd = FindWindow(0,lcDocName+' - Microsoft Word')
> ? lcDocName,hWnd
>endwith
>
>When I closed WORD the hWnd variable was displayed as 0 not a valid handle. Did I misunderstand something? I also have another question.
>
>Doesn't FindWindow() return a handle on a WORD document's window and FindWindowA() return a handle on the server application's window ie:WORD?
>If we used FindWindowA(), instead of FindWindow(), it wouldn't matter what the name of the active document was.
>
>Page 180 of Tamars' Book discusses FindWindowA(), not FindWindow(), with the Class for WORD = OpusApp.
>But FindWindowA("OpusApp", oword.caption) returns .T. Either the class of OpusApp is wrong or I am missing something.
>
>Any thoughts ?
>regards,
>
Dr.G. (Neil),
Nope OpusApp is correct for the window frame, but not the document. When you instantiate a Word.Application, of course, there's no document window.
As for FindWindowA(), it is the same function as FindWindow(). Many functions that return strings come in two flavors A and W (and I don't mean root beer, either< g >). The A versions are regular ASCII. The W version are for Unicode character sets. Which is being used depends on the localized version of Windows.
One suggestion. If you have access to the complete Visual Studio, there's a tool named Spy++. If you play around with that and Word you'll probably find some new stuff out.
George
Ubi caritas et amor, deus ibi est