Hi ,
I have problem with show document in word when run on W10 64bit. There run word on bottom belt as background and user must click to it to show document.
When run on w7 , word window show correct in foreground.
I tried several combinations, but no effect. What is wrong ?
I was looking for some parameter, (setforeground...), but any effect.
Here is part of code, if you can look and tell some tip, thanks
static FUNCTION WordFillDocument(cFile,aData,cSaveAs,cSaveAsPdf,nBearb,acnz1)
LOCAL oWord,oBM,oDoc,lWordFinished:=.F.,x
LOCAL cCakaj
LOCAL bSaveErrorBlock,oError // ošetrenie na chyby počas spracovania alebo zápisu do Wordu, PDF,
*default nBearb to 0
oWord := CreateObject("Word.Application")
* kontrola či je Word nainštalovaný
IF Empty( oWord )
MsgBox( "Microsoft Word nie je nainštalovaný, dokument sa nedá vytvoriť !" )
DC_Impl(cCakaj)
return .f.
ENDIF
oWord := oWord:dynamicCast(ActiveXObject())
oWord:Quit := {||lWordFinished := .T.}
oWord:visible := .F. // nezobrazuje word dokument počas spracovania
lWordFinished := .F.
oWord:documents:open( cFile, .F., .T. ) // toto som upravil podľa fóra news alaska
oDoc := oWord:ActiveDocument
oBM := oDoc:Bookmarks
// Replace the Bookmark with a new value
ReplaceBookmark(oBM , "CISLO_ZMLUVY" , aData[1] )
* ošetrenie na chyby počas tvorby a zápisu
bSaveErrorBlock:=ErrorBlock( {|e| Break(e)} ) // definovanie error bloku
BEGIN SEQUENCE
// Uloženie zmien do nového dokumentu DOC
IF(ValType(cSaveAs)=="C")
oDoc:saveas(cSaveAs)
ENDIF
// Uloženie zmien do nového dokumentu PDF
lulozitajpdf:=.T.
lulozitajpdf:=.F.
if lulozitajpdf==.T.
oDoc:ExportAsFixedFormat( cSaveasPdf, 17 )
cRet := cSaveasPdf
endif
sleep(10) // tu časové oneskorenie asi aby stihol zatvoriť dokument
* prepnutie na viditeľné zobrazenie dokumentu
oWord:visible := .T. // zobrazuje word dokument počas spracovania
*oWord:WindowState := 1 // toto je maximize
*oWord:WindowState := 2 // toto je minimize
oWord:WindowState := 3 // toto je normal
oWord:Activate()
oDoc:Activate() // skúšam 19.2.2018
* toto potrebné ako čakacia slučka aby nepustilo ďalej ako modal, čaká na ručné zatvorenie wordu
Do While !lWordFinished
nEvent:=AppEvent( @mp1, @mp2, @oXbp )
Enddo
RECOVER USING oError
oznam("Pozor! , súbor nie je možné uložiť, overte, či nie je dokument otvorený v inom okne")
END SEQUENCE
ErrorBlock(bSaveErrorBlock) // Restore old error code block
* zatvorenie vzorového dokumentu
oDoc:destroy()
sleep(30)
oWord:destroy()
sleep(30)
RETURN .t.
Word Active X foreground in Windows 10
Re: Word Active X foreground in Windows 10
Now I figured, than also when open word doc document like this :
DC_SpawnUrl(cestapnz+"Vzory\VzorNZ.doc",.F.,.F.) // sync,foreground
than on Windows 10 word open only on taskbar, on Windows 7 show on screen.
This is problem, because user no always look down to taskbar and can open multiply same document when I not lock this option.
How can force word open in normal mode ? This problem I have only with windows 10 ,...
DC_SpawnUrl(cestapnz+"Vzory\VzorNZ.doc",.F.,.F.) // sync,foreground
than on Windows 10 word open only on taskbar, on Windows 7 show on screen.
This is problem, because user no always look down to taskbar and can open multiply same document when I not lock this option.
How can force word open in normal mode ? This problem I have only with windows 10 ,...
Re: Word Active X foreground in Windows 10
I mean , that found problem. So again my
I test if is word installed :
FUNCTION JEMSWORD // zistenie, či na PC je Microsoft word nainštalovaný
LOCAL oWord,lmsword
oWord := CreateObject("Word.Application")
* kontrola či je Word nainštalovaný
IF Empty( oWord )
MsgBox( "Microsoft Word nie je nainštalovaný, dokument sa nedá vytvoriť !" )
lmsword:=.F.
return(lmsword)
ENDIF
lmsword:=.T.
oWord:destroy()
return(lmsword)
and after this I run DC_SpawnUrl(cestapnz+"Vzory\VzorNZ.doc",.F.,.F.) // sync,foreground
here is some problem, without control exist word word window open in normal size also on Windows 10.
So I must only repair some in JEMSWORD function to work correctly.
I test if is word installed :
FUNCTION JEMSWORD // zistenie, či na PC je Microsoft word nainštalovaný
LOCAL oWord,lmsword
oWord := CreateObject("Word.Application")
* kontrola či je Word nainštalovaný
IF Empty( oWord )
MsgBox( "Microsoft Word nie je nainštalovaný, dokument sa nedá vytvoriť !" )
lmsword:=.F.
return(lmsword)
ENDIF
lmsword:=.T.
oWord:destroy()
return(lmsword)
and after this I run DC_SpawnUrl(cestapnz+"Vzory\VzorNZ.doc",.F.,.F.) // sync,foreground
here is some problem, without control exist word word window open in normal size also on Windows 10.
So I must only repair some in JEMSWORD function to work correctly.
Re: Word Active X foreground in Windows 10
I have no problem running Word .DOC files on Windows 10 using DC_SpawnUrl().
It always comes up in the foreground.
I am testing with XDOT.EXE.
Send me the .DOC file you created.
It always comes up in the foreground.
I am testing with XDOT.EXE.
Send me the .DOC file you created.
The eXpress train is coming - and it has more cars.
Re: Word Active X foreground in Windows 10
Thanks for ansver,
Now I solved it, when include also oWord:quit() when close modified word document, or when test if MS Word exist.
FUNCTION JEMSWORD
LOCAL oWordtest,lmsword:=.T.
oWordtest := CreateObject("Word.Application")
sleep(20)
IF Empty( oWordtest )
MsgBox( "Microsoft Word nie je nainÜtalovanř, dokument sa nedß vytvoriŁ !" )
lmsword:=.F.
return(lmsword)
ENDIF
lmsword:=.T.
oWordtest:quit() // without this word open on taskbar only
sleep(20)
oWordtest:destroy()
sleep(20)
return(lmsword)
Now I solved it, when include also oWord:quit() when close modified word document, or when test if MS Word exist.
FUNCTION JEMSWORD
LOCAL oWordtest,lmsword:=.T.
oWordtest := CreateObject("Word.Application")
sleep(20)
IF Empty( oWordtest )
MsgBox( "Microsoft Word nie je nainÜtalovanř, dokument sa nedß vytvoriŁ !" )
lmsword:=.F.
return(lmsword)
ENDIF
lmsword:=.T.
oWordtest:quit() // without this word open on taskbar only
sleep(20)
oWordtest:destroy()
sleep(20)
return(lmsword)