Compartilhar via


SHEnableSoftkey

Windows Mobile SupportedWindows Embedded CE Not Supported

9/9/2008

Essa função ativa ou desativa individual leve teclas por identificador do comando ou índice.

Syntax

HRESULT SHEnableSoftkey(
  HWND hwndMenuBar,
  UINT uid,
  BOOL bByIndex,
  BOOL bEnable
);

Parameters

  • UID
    O identificador do comando o chave flexível ou o índice (0 ou 1). Se um chave flexível, em seguida, 0 indica SK1 e 1 indica SK2.
  • bByIndex
    Definir como TRUE se o UID parâmetro for um índice, FALSE se ele for um identificador do comando.
  • bEnable
    Defina como TRUE para habilitar o chave flexível, FALSE para desativá-lo.

Return Value

S_OK indica êxito; caso contrário, retorna um codificar falha.

Exemplo de código

O seguinte exemplo de código demonstra como usar SHEnableSoftkey.

Observação

Para fazer o seguinte exemplo de código mais fácil de ler, verificação de segurança e manipulação de erro não estão incluídos.Esta exemplo de código não deve ser usado em uma configuração versão a menos que ele foi modificado para incluí-las.

#include <aygshell.h>
HWND g_hwndMb;

LRESULT CALLBACK SHCreateMenuBarWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    bool bSKEnabled = TB_ISBUTTONENABLED(1);
    
    switch(message)
    {
        case WM_KEYDOWN:
        {
            // When the user presses the space key, toggle between enabling and disabling SK2.
            if (VK_SPACE == wParam)
            {
                if(bSKEnabled)
                {
                    SHEnableSoftkey(g_hwndMb, 1, TRUE, FALSE);
                }
                else
                {
                    SHEnableSoftkey(g_hwndMb, 1, TRUE, TRUE);
                }
            }
            break;
        }
    }
    return DefWindowProc(hwnd, message, wParam, lParam);
}

Requirements

Header aygshell.h
Library aygshell.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

See Also

Reference

Shell Functions

Concepts

Soft Keys on the Today Screen or Home Screen

Other Resources

Soft Key and Menu Guidelines