Page 1 of 1

multimedia-key determine in the screen

Posted: Thu Feb 09, 2012 1:46 pm
by hth
How can I determine the pushed multimedia-key in the screen-mode?

hth

Re: multimedia-key determine in the screen

Posted: Thu Feb 09, 2012 4:02 pm
by xorc1zt

Re: multimedia-key determine in the screen

Posted: Fri Feb 10, 2012 11:43 am
by hth
Sorry,
but KeyboardInkey() does not work with multimedia keys.

Actually I want to intercept the message of the multimedia remote control.
I think this just simulates a keystroke.

hth

Re: multimedia-key determine in the screen

Posted: Fri Feb 10, 2012 3:19 pm
by xorc1zt
ha sorry i did not understand

dunno on linux but on windows purebasic use DirectInput.

from the DirectX SDK

Code: Select all

#define DIK_CALCULATOR      0xA1    /* Calculator */
#define DIK_PLAYPAUSE       0xA2    /* Play / Pause */
#define DIK_MEDIASTOP       0xA4    /* Media Stop */
#define DIK_VOLUMEDOWN      0xAE    /* Volume - */
#define DIK_VOLUMEUP        0xB0    /* Volume + */
#define DIK_WEBHOME         0xB2    /* Web home */
[...]
you just need to translate the definitions for purebasic :

Code: Select all

#PB_Key_Mute            = $A0
#PB_Key_Calculator      = $A1
#PB_Key_PlayPause       = $A2
#PB_Key_MediaStop       = $A4
#PB_Key_VolumeDown      = $AE
#PB_Key_VolumeUp        = $B0
#PB_Key_WebHome         = $B2
#PB_Key_WebSearch       = $E5
#PB_Key_WebFavorites    = $E6
#PB_Key_WebRefresh      = $E7    
#PB_Key_WebStop         = $E8 
#PB_Key_WebForward      = $E9
#PB_Key_WebBack         = $EA
#PB_Key_MyComputer      = $EB
#PB_Key_Mail            = $EC
#PB_Key_MediaSelect     = $ED
here a full example which work with my keyboard.

Code: Select all


#PB_Key_Mute            = $A0
#PB_Key_Calculator      = $A1
#PB_Key_PlayPause       = $A2
#PB_Key_MediaStop       = $A4
#PB_Key_VolumeDown      = $AE
#PB_Key_VolumeUp        = $B0
#PB_Key_WebHome         = $B2
#PB_Key_WebSearch       = $E5
#PB_Key_WebFavorites    = $E6
#PB_Key_WebRefresh      = $E7    
#PB_Key_WebStop         = $E8 
#PB_Key_WebForward      = $E9
#PB_Key_WebBack         = $EA
#PB_Key_MyComputer      = $EB
#PB_Key_Mail            = $EC
#PB_Key_MediaSelect     = $ED


Define hud_string.s


InitSprite()
InitKeyboard()
OpenWindow( 0, 100, 100, 640, 480, "HELLO" )
OpenWindowedScreen( WindowID( 0 ), 0, 0, 640, 480, 1, 0, 0, #PB_Screen_NoSynchronization )

Repeat 
    Select WindowEvent()
        Case #PB_Event_CloseWindow
            quit=#True           
    EndSelect
   
    ClearScreen( $000000 )
    StartDrawing( ScreenOutput() )
    DrawText( 100, 100, hud_string )
    StopDrawing()
    FlipBuffers()
   
    ExamineKeyboard()
    hud_string + KeyboardInkey()

    If( KeyboardPushed( #PB_Key_Escape ) )
        quit = #True
    EndIf
    
    If( KeyboardPushed( #PB_Key_PlayPause ) )
        hud_string = "--- Play / Pause ---"
    EndIf
    
    If( KeyboardPushed( #PB_Key_MediaStop ) )
        hud_string = "--- Stop ---"
    EndIf
    
Until quit

Re: multimedia-key determine in the screen

Posted: Tue Feb 14, 2012 12:07 pm
by hth
All multimedia keys react only to
KeyboardPushed(128).
and KeyboardInkey() shows no reaction.

In the window this code responds correctly
http://forums.purebasic.com/german/view ... =8&t=23975

hth