Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Capturar Aplicação Externa .
Message
De
02/02/2004 15:39:58
 
 
À
02/02/2004 12:51:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00873022
Message ID:
00873128
Vues:
15
>Oi amigos !!!
>
>Teria jeito no fox ou via algum controle activex de criar um container de aplicação ?
>Por exemplo eu gostaria de executar o terminal services a partir da minha aplicação, mas
>ao abrir o terminal services eu conseguisse digitar a senha em um controle text1 nesse meu
>controle e essa senha fosse passada para o campo password do terminal services. Algo sem ctrl+c e ctrl+v.
>Isso é possível ?
>
Lázaro

Atravez deste voce pode mandar strings de digitação para outros aplicativos..

Para eles se comunicarem de uma forma mais "intima" o outro software teria que ser servidor COM+..

Mas espero que isto ajude:
parameter cwmyapptit, cwmyappexe, cwkeysto
set escape on
if  parameter()=0
    cwmyapptit = "Coloque aqui o caption da outra aplicação"
    cwmyappexe = "C:\appl_transfer\Transf.exe"
    cwkeysto   = chr(13)+"depois de um enter e após umTAB"+chr(09)+"depois de um TAB.."+chr(13)+chr(09)
endif
cwthiscap = _screen.caption
*
=go_declare()
*
oShell = CREATEOBJECT("WScript.Shell")
*
if  file(cwmyappexe)
    nhandler = ais_running(cwmyapptit)
    if  nhandler = 0
        RUN /N &cwmyappexe
        =Sleep(800)
    endif
else
    wait window nowait "Aplicativo "+cwmyappexe+" inexistente !!"
    return
endif
= Sleep(100)
do  while !empty(cwkeysto)
    cwkey = substr(cwkeysto,1,1)
    oShell.SendKeys(cwkey)
    cwkeysto = stuff(cwkeysto,1,1,"")
    if  empty(cwkeysto)
    else
        if  stuff(cwkeysto,1,1,"") = chr(13)
            = Sleep(400) && Pause VFP for a 1/10 of a second
        else
            = Sleep(100) && Pause VFP for a 1/10 of a second
        endif
    endif
enddo
** neste programa ele ainda aguarda o fim do outro aplicativo
* do aguarda_assistente with cwmyapptit, cwmyappexe, cwkeysto
return
*
FUNCTION ais_running
    * check if a given application is running
    LPARAMETER ctitle                       
    *
    hnext = getactivewindow()
    *
    * iterate through the open windows
    DO  WHILE hnext<>0
        ctext = REPLICATE(CHR(0),80)
        getwindowtext(hnext,@ctext,80)         && get window title
        IF  UPPER(ALLTRIM(ctitle)) $ UPPER(ctext)
            *
            RETURN hnext
        ENDIF
        hnext = getwindow(hnext,2)            && next window
    ENDDO
    * required window not found
    RETURN 0
ENDFUNC

FUNCTION go_declare
DECLARE Sleep IN Win32API;
    INTEGER dwMilliseconds
DECLARE INTEGER GetActiveWindow ;
    IN Win32API
DECLARE INTEGER GetWindow IN Win32API ;
    INTEGER HWND, INTEGER nType
DECLARE INTEGER GetWindowText IN Win32API ;
    INTEGER HWND, STRING @cText, INTEGER nType
DECLARE INTEGER BringWindowToTop IN Win32API ;
    INTEGER HWND
Declare integer SetActiveWindow in user32.dll ;
     integer hwnd
return
Claudio
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform