PDA

Ver la Versión Completa : como cargar en pantalla el teclado


satabel
30-01-2012, 10:13:08
Codial saludo

manejo delphi 7 , me pueden colaborar inidicando como presento el teclado en pantalla, gracias

olbeup
30-01-2012, 10:18:32
En San Google lo puedes encontrar, mira ésta (http://www.tustrucos.com/13-03-2008/software/teclado-virtual-en-windows-xp) página

Un saludo.

olbeup
30-01-2012, 10:23:19
También en el Club he encontrado esto (http://www.clubdelphi.com/foros/showthread.php?t=64021)
Un saludo.

P.D.: Sólo hay que buscar.

cesarsoftware
30-01-2012, 11:58:28
Hola satael.

Te lo pongo mas facil, esta son las funciones que uso yo habitualmente.


function SacaTeclado(): HWND;
var
TecladoPgm: string;
TecladoWND: HWND;
Resultado: integer;
msg: string;
begin
TecladoPGm := 'c:\windows\osk.exe' // se puede usar otro.
TecladoWND := FindWindow(nil, 'Teclado en pantalla'); // comprueba si esta en ram
if TecladoWND = 0 then
begin
Resultado := ShellExecute(Application.Handle, 'open', PChar(TecladoPgm), Pchar(''), PChar(ExtractFilePath(TecladoPgm)), SW_SHOW);
case Resultado of
0: msg := 'The operating system is out of memory or resources.';
ERROR_FILE_NOT_FOUND: msg := 'The specified file was not found.';
ERROR_PATH_NOT_FOUND: msg := 'The specified path was not found.';
ERROR_BAD_FORMAT: msg := 'The .exe file is invalid (non-Microsoft Win32 .exe or error in .exe image).';
SE_ERR_ACCESSDENIED: msg := 'The operating system denied access to the specified file.';
SE_ERR_ASSOCINCOMPLETE: msg := 'The file name association is incomplete or invalid.';
SE_ERR_DDEBUSY: msg := 'The Dynamic Data Exchange (DDE) transaction could not be completed because other DDE transactions were being processed.';
SE_ERR_DDEFAIL: msg := 'The DDE transaction failed.';
SE_ERR_DDETIMEOUT: msg := 'The DDE transaction could not be completed because the request timed out.';
SE_ERR_DLLNOTFOUND: msg := 'The specified DLL was not found.';
SE_ERR_NOASSOC: msg := 'There is no application associated with the given file name extension. This error will also be returned if you attempt to print a file that is not printable.';
SE_ERR_OOM: msg := 'There was not enough memory to complete the operation.';
SE_ERR_SHARE: msg := 'A sharing violation occurred.';
else
msg := 'Otro problema';
end;
if Resultado < 32 then
begin
Application.MessageBox(PChar('Problema al ejecutar' + #13 + TecladoPgm + #13 + msg), 'Error', MB_ICONERROR);
Result := TecladoWND;
Exit;
end;
EsperaSegundos(0.5); // Esperar a que se ejecute
TecladoWND := FindWindow(nil, 'Teclado en pantalla'); //encuentra la nueva ventana
if TecladoWND = 0 then
Application.MessageBox('No encuentro la ventana del teclado', 'Error', MB_ICONERROR);
end;
Result := TecladoWND;
end;

procedure CierraTeclado();
var
TecladoWND: HWND;
begin
TecladoWND := FindWindow(nil, 'Teclado en pantalla'); // comprueba si es esta en ram
if TecladoWND = 0 then
Exit;
CloseWindow(TecladoWND); // minimiza
PostMessage(TecladoWND, WM_CLOSE, 0, 0); // Cierra
end;