Hola a todos!!
Se que es una pregunta que debe contener una respuesta muy simple, pero la verdad no logro descubrirla.
Alguien sabe como desactivar el teclado? Necesito hacerlo mientras estoy ejecutando un proceso.
Gracias a todos!!
Saludos, Natalia.
Desactivar teclado
Re: Desactivar teclado
http://www.fivewin.com.br/exibedicas.asp?id=540nolgiati wrote:Hola a todos!!
Se que es una pregunta que debe contener una respuesta muy simple, pero la verdad no logro descubrirla.
Alguien sabe como desactivar el teclado? Necesito hacerlo mientras estoy ejecutando un proceso.
Gracias a todos!!
Saludos, Natalia.
http://www.fivewin.com.br/exibedicas.asp?id=477
http://www.fivewin.com.br/exibedicas.asp?id=461
http://www.fivewin.com.br/exibedicas.asp?id=369
http://www.fivewin.com.br/exibedicas.asp?id=367
Regards, saludos.
João Santos - São Paulo - Brasil
Re: Desactivar teclado
Karinha, desafortunadamente ya no funcionan los enlaces.
¿ Podrías poner como se hace el bloqueo del teclado ?
Muchas gracias.
¿ Podrías poner como se hace el bloqueo del teclado ?
Muchas gracias.
Re: Desactivar teclado
hola, creo sea esto:
Code: Select all
/*
06/07/07 - Desativar teclas especiais
Olá,
Neste exemplo que fiz associado a dll que é encontrada no endereço:
http://www.codeproject.com/win32/AntonioWinLock.asp
...é possível fazer o seguinte em FWH:
- Ativa/Desativar alt+tab
- Ativa/Desativar alt+esc
- Ativa/Desativar ctrl+alt+del
- Mostrar/Esconder a barra de tarefas
- Mostrar/Esconder o desktop
- Mostrar/Esconder o Start Button
- Mostrar/Esconder o System Clock
- Rodar um processo em outro desktop
Espero que gostem :-)
Abraços,
Rossine.
esta em ALTTAB.ZIP em dicas mais dicas
==============================================================================
En: 21/08/2008 - Manuel Mercado Gentilmente Converteu Para FIVEWIN FOR XHARBOUR
Hola João
Una conversión rápida del ejemplo de Rossine a su versión en C directamente
con FWH sin Dll's
Manuel Mercado
*/
#Include "FiveWin.Ch"
#Include "Dll.Ch"
Function Teclado() //Main()
/*
MsgStop( StartButton( .F. ), "Desabilitando o botão Start(Iniciar) - Win 9x, NT, 2K, XP" )
MsgStop( StartButton( .T. ), "Habilitando o botão Start(Iniciar) - Win 9x, NT, 2K, XP" )
MsgStop( ShowDesktop( .F. ), "Desabilitando o Desktop - Win 9x, NT, 2K, XP" )
MsgStop( DesktopProc( "MyDesktop2", "Calc.exe" ), "Executando uma tarefa em outro desktop - Win NT, 2K, XP" )
MsgStop( ShowDesktop( .T. ), "Habilitando o Desktop - Win 9x, NT, 2K, XP" )
MsgStop( ShowTaskbar( .F. ), "Desabilitando o Taskbar(Barra de Tarefas) - Win 9x, NT, 2K, XP" )
MsgStop( ShowTaskbar( .T. ), "Habilitando o Taskbar(Barra de Tarefas) - Win 9x, NT, 2K, XP" )
MsgStop( ShowClock( .F. ), "Desabilitando o Clock(Relogio) - Win 9x, NT, 2K, XP" )
MsgStop( ShowClock( .T. ), "Habilitando o Clock(Relogio) - Win 9x, NT, 2K, XP" )
MsgStop( AltTabEnable( 0, .F. ), "Desabilitando ALT+TAB e ALT+ESC - Windows NT, 2k" )
MsgStop( AltTabEnable( 0, .T. ), "Habilitando ALT+TAB e ALT+ESC - Windows NT, 2k" )
// Para Windows XP/NT e 2000 / 2003
IF IsWinNT() .OR. IsWin2000() //??? Nao testei em 2000/2003
MsgStop( CtrlAltDel( .F. ), "Desabilitando o Ctrl+Alt+Del - Windows NT, 2k" )
MsgStop( CtrlAltDel( .T. ), "Habilitando o Ctrl+Alt+Del - Windows NT, 2k" )
ELSE //-> Windows 95/98 - Millenium Edition
Ctrl_Alt_Del( .f. )
MsgAlert( "CTRL+ALT+DEL DESLIGADO" + CRLF + "Please, press CTRL + ALT + DEL", "Desligado" )
Ctrl_Alt_Del( .t. )
MsgAlert( "CTRL+ALT+DEL LIGADO" + CRLF + "Please, press CTRL + ALT + DEL", "Ligado" )
ENDIF
*/
Return Nil
//
//-> Comentario: Simplesmente, FANTASTICO!!!
//
//-> Complementando para Windows 95/98 Milleniun Edition
//
// Antonio Carlos Pantaglione
// Toninho@fwi.com.br
// Agosto/2001
//
//#include "fivewin.ch"
//#include "dll.ch"
//----------------------------------------------------------------------------//
//-> Modifiquei para nao ter choque com a funcao par o Windows NT(XP)
Function Ctrl_Alt_Del( lState )
if !lState
SysParInfo( 97, 1, 0, 0 )
else
SysParInfo( 97, 0, 0, 0 )
endif
return Nil
//----------------------------------------------------------------------------//
dll32 static function SysParInfo( uAction AS LONG, uParam AS LONG, vParam AS LONG, uWinIni AS LONG ) ;
AS LONG PASCAL FROM "SystemParametersInfoA" LIB "User32.dll"
//----------------------------------------------------------------------------//
//-> Rotina em C -> By Manuel Mercado - The Best
#pragma BEGINDUMP
#include <windows.h>
#include <stdlib.h>
#include <hbapi.h>
#define ID_STARTBUTTON 0x130 // Start button ID
#define ID_TRAY 0x12F // System tray ID
#define ID_CLOCK 0x12F // System clock ID
#define PROGRAM_MANAGER "Program Manager" // Program manager window name
#define TASKBAR "Shell_TrayWnd" // Taskbar class name
int WINAPI TaskManager_Enable_Disable( BOOL ) ;
int WINAPI StartButton_Show_Hide( BOOL ) ;
int WINAPI Desktop_Show_Hide( BOOL ) ;
int WINAPI Process_Desktop(char *, char * ) ;
int WINAPI Taskbar_Show_Hide( BOOL ) ;
int WINAPI Clock_Show_Hide( BOOL ) ;
int WINAPI AltTab_Enable_Disable( HWND, BOOL ) ;
BOOL StartProcess( char *, char * ) ;
LRESULT CALLBACK LowLevelMouseHookProc( int nCode, WORD wParam, DWORD lParam ) ;
LRESULT CALLBACK MouseHookProc( int nCode, WORD wParam, DWORD lParam ) ;
HHOOK hHook ; // Mouse hook
HINSTANCE hInst ; // Instance handle
HB_FUNC( ALTTABENABLE )
{
HWND hWnd = (HWND ) hb_parnl( 1 ) ;
BOOL bEnable = hb_parl( 2 ) ;
int iRet ;
iRet = AltTab_Enable_Disable( hWnd, bEnable ) ;
hb_retni( iRet ) ;
}
HB_FUNC( SHOWCLOCK )
{
BOOL bShow = hb_parl( 1 ) ;
int iRet ;
iRet = Clock_Show_Hide( bShow ) ;
hb_retni( iRet ) ;
}
HB_FUNC( SHOWTASKBAR )
{
BOOL bShow = hb_parl( 1 ) ;
int iRet ;
iRet = Taskbar_Show_Hide( bShow ) ;
hb_retni( iRet ) ;
}
HB_FUNC( DESKTOPPROC )
{
char* c1 = hb_parc( 1 ) ;
char* c2 = hb_parc( 2 ) ;
int iRet ;
iRet = Process_Desktop( c1, c2 ) ;
hb_retni( iRet ) ;
}
HB_FUNC( SHOWDESKTOP )
{
BOOL bShow = hb_parl( 1 ) ;
int iRet ;
iRet = Desktop_Show_Hide( bShow ) ;
hb_retni( iRet ) ;
}
HB_FUNC( STARTBUTTON )
{
BOOL bShow = hb_parl( 1 ) ;
int iRet ;
iRet = StartButton_Show_Hide( bShow ) ;
hb_retni( iRet ) ;
}
HB_FUNC( CTRLALTDEL )
{
BOOL bEnable = hb_parl( 1 ) ;
int iRet ;
iRet = TaskManager_Enable_Disable( bEnable ) ;
hb_retni( iRet ) ;
}
int WINAPI TaskManager_Enable_Disable(BOOL bEnableDisable)
{
#define KEY_DISABLETASKMGR "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"
#define VAL_DISABLETASKMGR "DisableTaskMgr"
HKEY hKey;
DWORD val;
LONG r;
if (RegOpenKey(HKEY_CURRENT_USER, KEY_DISABLETASKMGR, &hKey) != ERROR_SUCCESS)
if (RegCreateKey(HKEY_CURRENT_USER, KEY_DISABLETASKMGR, &hKey) != ERROR_SUCCESS)
return 0;
if (bEnableDisable) // Enable
{
r = RegDeleteValue(hKey, VAL_DISABLETASKMGR);
}
else // Disable
{
val = 1;
r = RegSetValueEx(hKey, VAL_DISABLETASKMGR, 0, REG_DWORD, (BYTE *)&val, sizeof(val));
}
RegCloseKey(hKey);
return (r == ERROR_SUCCESS ? 1 : 0) ;
}
int WINAPI StartButton_Show_Hide( BOOL bShowHide )
{
HWND hWnd;
hWnd = GetDlgItem( FindWindow( TASKBAR, NULL ), ID_STARTBUTTON ) ;
if ( hWnd == NULL )
return 0 ;
ShowWindow( hWnd, bShowHide ? SW_SHOW : SW_HIDE) ;
UpdateWindow( hWnd );
return 1 ;
}
int WINAPI Taskbar_Show_Hide( BOOL bShowHide )
{
HWND hWnd;
hWnd = FindWindow( TASKBAR, NULL ) ;
if ( hWnd == NULL )
return 0 ;
ShowWindow( hWnd, bShowHide ? SW_SHOW : SW_HIDE ) ;
UpdateWindow(hWnd) ;
return 1 ;
}
int WINAPI Desktop_Show_Hide( BOOL bShowHide )
{
OSVERSIONINFO osvi ;
BOOL bIsWindowsNT4SP3orLater ;
int iServicePack ;
char *p ;
// Determine the current windows version
osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ) ;
GetVersionEx( &osvi );
for (p = osvi.szCSDVersion; *p && ! isdigit( *p ) ; *p++ ) ;
iServicePack = atoi( p ) ;
bIsWindowsNT4SP3orLater = ( osvi.dwPlatformId == VER_PLATFORM_WIN32_NT ) &&
( ( ( osvi.dwMajorVersion == 4 ) && ( iServicePack >= 3 ) ) ||
( osvi.dwMajorVersion > 4 ) ) ;
if ( ! bShowHide )
{
if ( ! hHook )
{
hHook = SetWindowsHookEx( bIsWindowsNT4SP3orLater ? WH_MOUSE_LL : WH_MOUSE,
bIsWindowsNT4SP3orLater ? ( HOOKPROC )LowLevelMouseHookProc : ( HOOKPROC )MouseHookProc,
hInst, 0 ) ;
if ( ! hHook )
return 0 ;
}
}
else
{
UnhookWindowsHookEx(hHook);
hHook = NULL;
}
return SetWindowPos( FindWindow( NULL, PROGRAM_MANAGER ), NULL, 0, 0, 0, 0,
bShowHide ? SWP_SHOWWINDOW : SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER);
}
LRESULT CALLBACK LowLevelMouseHookProc( int nCode, WORD wParam, DWORD lParam )
{
PMSLLHOOKSTRUCT p = (PMSLLHOOKSTRUCT)lParam ;
HWND hWnd = WindowFromPoint( p->pt ) ;
if( nCode >= 0 )
{
if ( ( wParam == WM_LBUTTONDOWN || wParam == WM_RBUTTONDOWN ) && hWnd == GetDesktopWindow() )
{
return 1 ;
}
}
return CallNextHookEx( hHook, nCode, wParam, lParam ) ;
}
LRESULT CALLBACK MouseHookProc( int nCode, WORD wParam, DWORD lParam )
{
if( nCode >= 0 )
{
if ( wParam == WM_LBUTTONDBLCLK )
{
if ( ( ( MOUSEHOOKSTRUCT * )lParam )->hwnd == GetDesktopWindow() )
{
return 1 ;
}
}
}
return CallNextHookEx( hHook, nCode, wParam, lParam ) ;
}
int WINAPI Process_Desktop(char *szDesktopName, char *szPath )
{
HDESK hOriginalThread ;
HDESK hOriginalInput ;
HDESK hNewDesktop ;
// Save original ...
hOriginalThread = GetThreadDesktop( GetCurrentThreadId() ) ;
hOriginalInput = OpenInputDesktop( 0, FALSE, DESKTOP_SWITCHDESKTOP ) ;
// Create a new Desktop and switch to it
hNewDesktop = CreateDesktop( szDesktopName, NULL, NULL, 0, GENERIC_ALL, NULL ) ;
SetThreadDesktop( hNewDesktop ) ;
SwitchDesktop( hNewDesktop ) ;
// Execute process in new desktop
StartProcess( szDesktopName, szPath ) ;
// Restore original ...
SwitchDesktop( hOriginalInput ) ;
SetThreadDesktop( hOriginalThread ) ;
// Close the Desktop
CloseDesktop( hNewDesktop ) ;
return 0 ;
}
BOOL StartProcess( char *szDesktopName, char *szPath )
{
STARTUPINFO si ;
PROCESS_INFORMATION pi ;
// Zero these structs
ZeroMemory( &si, sizeof( si ) ) ;
si.cb = sizeof( si ) ;
si.lpTitle = szDesktopName ;
si.lpDesktop = szDesktopName ;
ZeroMemory( &pi, sizeof( pi ) ) ;
// Start the child process
if (!CreateProcess( NULL, // No module name (use command line).
szPath, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) ) // Pointer to PROCESS_INFORMATION structure.
{
return FALSE ;
}
// Wait until process exits
WaitForSingleObject( pi.hProcess, INFINITE ) ;
// Close process and thread handles
CloseHandle( pi.hProcess ) ;
CloseHandle( pi.hThread ) ;
return TRUE ;
}
int WINAPI Clock_Show_Hide( BOOL bShowHide )
{
HWND hWnd ;
hWnd = GetDlgItem( FindWindow( TASKBAR, NULL ), ID_TRAY ) ;
hWnd = GetDlgItem( hWnd, ID_CLOCK ) ;
if ( hWnd == NULL )
return 0 ;
ShowWindow( hWnd, bShowHide ? SW_SHOW : SW_HIDE ) ;
UpdateWindow( hWnd ) ;
return 1 ;
}
int WINAPI AltTab_Enable_Disable( HWND hWnd, BOOL bEnableDisable )
{
#define m_nHotKeyID 100
if ( ! bEnableDisable )
{
if ( ! RegisterHotKey( hWnd, m_nHotKeyID+0, MOD_ALT, VK_TAB ) ) // Alt+Tab
return 0 ;
if ( ! RegisterHotKey( hWnd, m_nHotKeyID+1, MOD_ALT, VK_ESCAPE ) ) // Alt+Esc
return 0 ;
}
else
{
if ( ! UnregisterHotKey( hWnd, m_nHotKeyID + 0 ) )
return 0 ;
if ( ! UnregisterHotKey( hWnd, m_nHotKeyID + 1 ) )
return 0 ;
}
return 1 ;
}
#pragma ENDDUMP
/*
Saludos
Manuel Mercado
*/
João Santos - São Paulo - Brasil
Re: Desactivar teclado
Karinha.
Muchas gracias !!
Muchas gracias !!