PC SOFT
DEPOT EN LIGNE
POUR WINDEVWEBDEV ET WINDEV MOBILE

WD The SendKey function - Abra um aplicativo e mande para ele comandos como o bloco de notas e calculadora e consiga interagir c
Publié par Boller
dans la catégorie Outils
Nouveautés



Description
WD The SendKey function - Abra um aplicativo e mande para ele comandos como o bloco de notas e calculadora e consiga interagir com eles com esse exemplo

ShellExecute("notepad.exe")


hDestination is int

hDestination = FindHandle("Notepad")

IF hDestination = 0 THEN
RESULT False
END

sSend is string = EDT_NOTEPAD
sSend=Replace(sSend,"+","{+}")
sSend=Replace(sSend,"^","{^}")
sSend=Replace(sSend,"%","{%}")
sSend=Replace(sSend,"(","{(}")
sSend=Replace(sSend,")","{)}")

// Send the sequence
IF NOT SendKey(sSend,hDestination) THEN
Error("Pb while sending the sequence "+EDT_NOTEPAD)
RESULT False
ELSE
RESULT True
END

tRecipient is int

tRecipient = FindHandle("NotePad")

// Sends the Alt-F4 sequence to the application to close it
IF NOT SendKey("%{F4}",tRecipient) THEN
Error("Pb while sending the sequence %{F4}")
RESULT False
ELSE
RESULT True
END

Illustrations, copies d'écran
none
none
Avis des utilisateurs
(Pour noter la ressource, cliquez sur Ecrire un avis)
Boller
Global init project

// Include the "KeyConst.wl" file to manage the keyboard keys
EXTERN "KeyConst.WL"
Boller
PROCEDURE EVENTO_PrintScreen()

SendKey("{PRTSC}")

IF ClipboardFormat(cfBitmap) = True THEN

Info("ok")

Clipboard(WIN_PrintScreen.IMG_Printscreen)

END

t001_screens.t001_datahora = DateSys()+TimeSys()

t001_screens.t001_resolucaotela = SysXRes() + "X" + SysYRes()

t001_screens.t001_screem = WIN_PrintScreen.IMG_Printscreen

IF HAdd(t001_screens) = True THEN

Info("Gravou com sucesso!")

END
Boller
giImage is Image
giImage = dCopyScreenImage()

HReset(Captura)
Captura.Data = DateSys()
Captura.Hora = TimeSys()
Captura.Rotina = gsRotina
Captura.Observacao = gsObservacao
dResize(giImage,giImage..Width/1.2,giImage..Height/1.2)
Captura.Tela = giImage
HAdd(Captura)