I am looking for a working code example for Symbian S60 5th edition in which a console application can receive power off events (i.e. detect phone switch off). I know how to do this from UI application [AppUI, HandleSystemEventL(const TWsEvent& aEvent), etc], but Windows Server does not seem to send events if simple console application is listening to these events.
So, I have tried to connect to WS, call EventReady(&iStatus), but RunL is never called, and the application never receives EApaSystemEventShutdown.
Can anyone here provide working code for this?
Thank you.
You can use CSaveNotifier (savenotf.h, powermgrcli.lib) to receive powerdown notifications. Sorry, don't have a code snippet available at the moment.
Related
I am making a program that opens a website called Smashladder (https://www.smashladder.com/netplay?tab=matches), initiates matchmaking and then opens the emulator and basically does all the steps to connect to the opponent. When you match with someone, it sends a desktop notification (at least mine does). I want to have the program halt until the notification is sent then continue the program. How would I be able to have that information in a bool form (i.e notification was sent (t/f))?
edit: This is being made on windows 10.
I have a C++ Windows service which starts a TCP server when booted.
The problem is that when the user logs on/off the service no longer responses to client requests, also when returns from hibernation. So I need to get notified about the power modes so that I suspend/resume the server the proper way.
I tried ServiceBase.OnPowerEvent() but visual studio says it is undefined. is this method available only for C#? is there a counterpart in C++?
It is worth mentioned that the service template I used have downloaded it from an online tutorial, not the default template that comes with VS.
ServiceBase.OnPowerEvent is for .Net services based on ServiceBase. It is a wrapper of SERVICE_CONTROL_POWEREVENT.Services are also notified of log on and log off events via SERVICE_CONTROL_SESSIONCHANGE.
For a list of notification code, check HandlerEx callback function
Am developing a remote access application, like teamviewer. Where i will be sending mouse events from client to server (executed at server using mouse_event() function). But for some reason mouse events are blocked, server is able to receive them and post them to OS using mouse_event() api, but there is no result.
Is there any tool to check, why OS has not executed these mouse events.
Note: Key board events work well and good. And i tried SendInput() api also.
Am developing the application using C++ on windows.
Please let me know your suggestions on the same.
Thanks in advance,
Paul.
When i double click on my server exe it runs as a console application and i can see the logs in console.
I have made a windows service using the code given at http://code.msdn.microsoft.com/windowsdesktop/CppWindowsService-cacf4948
Using this the server runs in background but i cant see the console. Can anyone tell me how can i send messages to the console from a service??
Thanks!
Got it! I print my logs from my service to a pipe handle and i just wrote a simple pipe client which reads the file and displays it in the console.
If anyone needs the code then ill post it here
Thanks!
Starting from Windows Vista the services are executed in a different session so most communications will not work.
http://msdn.microsoft.com/en-us/library/windows/hardware/gg463353.aspx
Microsoft have some ways to communicate with services as described here (only first paragraph).
http://msdn.microsoft.com/en-us/library/windows/desktop/ms683502%28v=vs.85%29.aspx
I have a C/C++ Windows Mobile 6.5 application that continuously runs on the phone. It needs to analyze the SMSes. How can I be notified in my application about an incoming SMS? I read in MSDN about the SmsSetMessageNotification() but this is starting an application once the SMS comes in, and in my case the application is already running, it just needs to be informed that a new SMS was received and then should have access to it in order to analize it and to decide if it's of any interest for the application or not.
So how can my already running application be informed about an incoming SMS which then needs to be analyzed?
I believe you need to use the IMailRuleClient to sign up for notifications of a text message being received.
There is a sample application as part of the sdk that demonstrates this functionality. You can download it from MSDN Code Samples
You can achieve your goal using the Radio Interface Layer (RIL) API. Download RIL.H to get started. Then use LoadLibrary and GetProcAddress to dynamically call the RIL functions from the DLL at runtime. You can setup a RIL notification callback to notify you when message activity happens. I found a code example here.