Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bring Excel to front
Message
 
À
13/08/2013 08:27:06
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01580013
Message ID:
01580372
Vues:
56
J'aime (1)
>Hilmar -
>
>Could you post the code you used to accomplish this? I, too, am interested in this.
>
>Thanks,
>
>Jim

Based on: http://www.tek-tips.com/faqs.cfm?fid=4262
RELEASE goExcel
Public goExcel
goExcel=CREATEOBJECT('excel.application')
goExcel.Visible=.t.
ForceForegroundWindow(goExcel.Hwnd)

FUNCTION ForceForegroundWindow(lnHWND)

    LOCAL nForeThread, nAppThread
    
    DECLARE Long BringWindowToTop In Win32API Long

    DECLARE Long ShowWindow In Win32API Long, Long

    DECLARE INTEGER GetCurrentThreadId; 
        IN kernel32
     
    DECLARE INTEGER GetWindowThreadProcessId IN user32; 
        INTEGER   hWnd,; 
        INTEGER @ lpdwProcId  
     
    DECLARE INTEGER GetCurrentThreadId; 
        IN kernel32  
        
    DECLARE INTEGER AttachThreadInput IN user32 ;
        INTEGER idAttach, ;
        INTEGER idAttachTo, ;
        INTEGER fAttach

    DECLARE INTEGER GetForegroundWindow IN user32  
 
    nForeThread = GetWindowThreadProcessId(GetForegroundWindow(), 0)
    nAppThread = GetCurrentThreadId()

    IF nForeThread != nAppThread
        AttachThreadInput(nForeThread, nAppThread, .T.)
        BringWindowToTop(lnHWND)
        ShowWindow(lnHWND,3)
        AttachThreadInput(nForeThread, nAppThread, .F.)
    ELSE
        BringWindowToTop(lnHWND)
        ShowWindow(lnHWND,3)
    ENDIF
    
ENDFUNC
Frank Camp
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform