Hi,
i am try to simulationg the Defeaultphoney keys, priviously i simulated LeftSoftkey and RightSoftKey of the Phone Window Group its working fine.
Now i am try to simulate the valumeInckey and volumedecKey ut noe its not woking.
i am using this code.
TInt CAppUi::HandleVolumeControls(TInt aKey)
{
RWsSession sess=CCoeEnv::Static()->WsSession();
TWsEvent event;
TInt id=sess.FindWindowGroupIdentifier( 0, _L("*Phone*") );
event.SetType(EEventKey);
event.SetTimeNow();
if(aKey == EKeyLeftArrow)
{
event.Key()->iCode = EKeyDecVolume;//EKeyLeftArrow; i tried this one also
if(iLoudSpeakerVolume > 1)
{
iLoudSpeakerVolume--;
}
else
{
iLoudSpeakerVolume = 1;
}
}
else if(aKey == EKeyRightArrow)
{
event.Key()->iCode = EKeyIncVolume;//EKeyRightArrow;//EKeyDevice0;//EKeyCBA1;
if(iLoudSpeakerVolume>=10)
{
iLoudSpeakerVolume = 10;
}
else
{
iLoudSpeakerVolume++;
}
}
event.Key()->iModifiers = 0;
event.Key()->iRepeats = 0;
event.Key()->iScanCode = EStdKeyNull;
sess.SendEventToWindowGroup( id, event );
return iLoudSpeakerVolume;
}

Reply With Quote



