I don't know how technically accurate or efficient this is but it's what I've tried and so far worked for me.
Here's the scenario.
Based on snippet above, you can see after exporting some data into an Excel file, I wished to inform the user the full path of where it was saved. After that was done I'd like to bring Excel into focus. After trying a couple of ways, SetFocusAfter() works as I need it to and this is how it was coded:
Here's the scenario.
.
.
oExcel:ActiveWorkBook:SaveAs(cFullPath)
oExcel:DisplayAlerts := .t.
msginfo("Data has been saved at"+CRLF+cFullPath)
SetFocusAfter(FindWindow( "XLMAIN", 0 ))
oExcel:visible := .t.
.
.Based on snippet above, you can see after exporting some data into an Excel file, I wished to inform the user the full path of where it was saved. After that was done I'd like to bring Excel into focus. After trying a couple of ways, SetFocusAfter() works as I need it to and this is how it was coded:
function SetFocusAfter(hWnd)
local oTimer
define timer oTimer interval 500 of oWnd ;
action (BringWindowToTop(hWnd), oTimer:DeActivate())
activate timer oTimer
return NilFWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
BCC5.82/BCC7.3
xHarbour/Harbour