FIX CAPSLOCK ON

FIX CAPSLOCK ON

Postby Jack » Mon Nov 04, 2024 10:11 am

Hi,
I 'd like to fix the caps lock to ON .

How to ?

Thanks

Philippe
Jack
 
Posts: 288
Joined: Wed Jul 11, 2007 11:06 am

Re: FIX CAPSLOCK ON

Postby karinha » Mon Nov 04, 2024 2:17 pm

Jack wrote:Hi,
I 'd like to fix the caps lock to ON .

How to ?

Thanks

Philippe


Good morning. Use google translate, pls.

Code: Select all  Expand view

#include "fivewin.ch"
// #include "Dll.ch"

// ----------------------------------------------------------------------
// Vejam com funciona
// ----------------------------------------------------------------------
// SETCAPSLOCK( .T. ou .F. )  = Liga e desliga o Capslock
// SETNUMLOCK( .T. ou .F. )   = Liga e desliga o NumLock
// SETSCROLLOCK( .T. ou .F. ) = Liga e desliga o ScrollLock
// SETINSERT( .T. ou .F. )    = Liga e desliga o Insert
// ----------------------------------------------------------------------
// VERCAPSLOCK()  = Sem parametros retorna o estado do Capslock
// VERNUMLOCK()   = Sem parametros retorna o estado do NumLock
// VERSCROLLOCK() = Sem parametros retorna o estado do ScrollLock
// VERINSERT()    = Sem parametros retorna o estado do Insert
// ----------------------------------------------------------------------

/*
*************
function MAIN
*************

? SETCAPSLOCK( .F. )
? "Desligando o CapsLock"
SETCAPSLOCK( .T. )
? "Ligando o CapsLock"
SETCAPSLOCK( .F. )
? "Desligando o CapsLock"
SETCAPSLOCK( .T. )
? "Ligando o CapsLock"
SETCAPSLOCK( .F. )
? "Desligando o CapsLock"

? "O Capslock esta' " + iif( VERCAPSLOCK(), "Ligado", "Desligado" )

SETNUMLOCK( .F. )
? "Desligando o NumLock"
SETNUMLOCK( .T. )
? "Ligando o NumLock"
SETNUMLOCK( .F. )
? "Desligando o NumLock"
SETNUMLOCK( .T. )
? "Ligando o NumLock"
SETNUMLOCK( .F. )
? "Desligando o NumLock"

? "O Numlock esta' " + iif( VERNUMLOCK(), "Ligado", "Desligado" )

SETSCROLLOCK( .F. )
? "Desligando o ScrollLock"
SETSCROLLOCK( .T. )
? "Ligando o ScrollLock"
SETSCROLLOCK( .F. )
? "Desligando o ScrollLock"
SETSCROLLOCK( .T. )
? "Ligando o ScrollLock"
SETSCROLLOCK( .F. )
? "Desligando o ScrollLock"

? "O ScrollLock esta' " + iif( VERSCROLLOCK(), "Ligado", "Desligado" )

SETINSERT( .T. )
? "Ligando o Insert"

SETINSERT( .F. )
? "Desligando o Insert"

? "O Insert esta' " + iif( VERINSERT(), "Ligado", "Desligado" )

return NIL
*/


// ------------------------------------------------------------*
// FUNCAO PARA ATIVAR A TECLA CAPSLOCK             *
// ------------------------------------------------------------*

#pragma begindump

#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400

#include <windows.h>
#include "hbapi.h"

HB_FUNC ( SETCAPSLOCK )
{
BYTE keyState[256];

GetKeyboardState((LPBYTE)&keyState);

if( (hb_parl(1) && !(keyState[VK_CAPITAL] & 0)) || (!hb_parl(1) && (keyState[VK_CAPITAL] & 1)) )
    {
      keybd_event( VK_CAPITAL, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0 );
      keybd_event( VK_CAPITAL, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
    }
}

#pragma enddump

// -----------------------------------------------------------*
// FUNCAO PARA ATIVAR A TECLA NUMLOCK             *
// -----------------------------------------------------------*

#pragma begindump

#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400

#include <windows.h>
#include "hbapi.h"

HB_FUNC ( SETNUMLOCK )
{
BYTE keyState[256];

GetKeyboardState((LPBYTE)&keyState);

if( (hb_parl(1) && !(keyState[VK_NUMLOCK] & 0)) || (!hb_parl(1) && (keyState[VK_NUMLOCK] & 1)) )
    {
      keybd_event( VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0 );
      keybd_event( VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
    }
}

#pragma enddump

// -----------------------------------------------------------*
// FUNCAO PARA ATIVAR A TECLA SCROLLOCK           *
// -----------------------------------------------------------*

#pragma begindump

#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400

#include <windows.h>
#include "hbapi.h"

HB_FUNC ( SETSCROLLOCK )
{
BYTE keyState[256];

GetKeyboardState((LPBYTE)&keyState);

if( (hb_parl(1) && !(keyState[VK_SCROLL] & 0)) || (!hb_parl(1) && (keyState[VK_SCROLL] & 1)) )
    {
      keybd_event( VK_SCROLL, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0 );
      keybd_event( VK_SCROLL, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
    }
}

#pragma enddump

// -----------------------------------------------------------*
// FUNCAO PARA ATIVAR A TECLA SCROLLOCK           *
// -----------------------------------------------------------*

#pragma begindump

#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400

#include <windows.h>
#include "hbapi.h"

HB_FUNC ( SETINSERT )
{
BYTE keyState[256];

GetKeyboardState((LPBYTE)&keyState);

if( (hb_parl(1) && !(keyState[VK_INSERT] & 0)) || (!hb_parl(1) && (keyState[VK_INSERT] & 1)) )
    {
      keybd_event( VK_INSERT, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0 );
      keybd_event( VK_INSERT, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
    }
}

#pragma enddump

#pragma begindump

#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400

#include <windows.h>
#include "hbapi.h"

HB_FUNC ( VERCAPSLOCK )
{
BYTE keyState[256];

GetKeyboardState((LPBYTE)&keyState);

hb_retl( keyState[VK_CAPITAL] );
}

#pragma enddump

// -----------------------------------------------------------*
// FUNCAO PARA VERIFICAR A TECLA NUMLOCK          *
// -----------------------------------------------------------*

#pragma begindump

#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400

#include <windows.h>
#include "hbapi.h"

HB_FUNC ( VERNUMLOCK )
{
BYTE keyState[256];

GetKeyboardState((LPBYTE)&keyState);

hb_retl( keyState[VK_NUMLOCK] );
}

#pragma enddump

// -----------------------------------------------------------*
// FUNCAO PARA VERIFICAR A TECLA SCROLLOCK          *
// -----------------------------------------------------------*

#pragma begindump

#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400

#include <windows.h>
#include "hbapi.h"

HB_FUNC ( VERSCROLLOCK )
{
BYTE keyState[256];

GetKeyboardState((LPBYTE)&keyState);

hb_retl( keyState[VK_SCROLL] );
}

#pragma enddump

// -----------------------------------------------------------*
// FUNCAO PARA VERIFICAR A TECLA SCROLLOCK          *
// -----------------------------------------------------------*

#pragma begindump

#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400

#include <windows.h>
#include "hbapi.h"

HB_FUNC ( VERINSERT )
{
BYTE keyState[256];

GetKeyboardState((LPBYTE)&keyState);

hb_retl( keyState[VK_INSERT] );
}

#pragma enddump

// FIN / END
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: FIX CAPSLOCK ON

Postby Jack » Tue Nov 05, 2024 1:55 pm

Thanks for your help .
Problem solved .

Philippe
Jack
 
Posts: 288
Joined: Wed Jul 11, 2007 11:06 am

Re: FIX CAPSLOCK ON

Postby karinha » Tue Nov 05, 2024 2:14 pm

Great!

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 89 guests