Hi,

I'm working on a background application and have to use RWsSession to send key events to another application, but it doesn't seem to work. I tried several methods suggested in the wiki (http://wiki.forum.nokia.com/index.ph...ate_a_keypress) with no luck. I tried the TKeyEvent and both TRawEvent approaches (using UserSvr and RWsSession), but neither produced any results.

The TKeyEvent approach, that I tried last, behaves in an interesting way: I connect to the WS using the following code:
RWsSession ws;
UserLeaveIfError( ws.Connect() );
The code does not leave. Then I send the event using ws.SimulateEvent and in the end I call ws.Flush() which never returns. Also int the other experiments I found that RWsSession.Close() would do the same: when I pushed it to the cleanup stack using CleanupClosePushL, the PopAndDestroy() call would block infinitely.

Is there any special magic that has to be done so that I can connect to the window server from a non-gui application? The WS is running, because I'm starting the application from the phone menu (it has a launcher icon both in the emulator and on the real phone), so I'm not running the whole emulator in console mode, just this app.

It's quite strange that the RWsSession seems to connect without any problem and then it freezes. Maybe it needs some active object magic?

Thanks,
Laszlo