Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a background process with system tray icon

I'm trying to make a Windows app that checks some things in the background, and inform the user via a systray icon.

The app is made with Not managed C++ and there is no option to switch to .net or Java.

If the user wants to stop the app, he will use the tray icon.

The app can't be a Service because of the systray side and because it must run without installing anything on the user computer ( it's a single .exe )

Using the typical Win32 program structure ( RegisterClass, WndProc and so on ) i dont know how can i place some code to run apart the window message loop. Maybe i have to use CreateProcess() or CreateThread()? Is It the correct way to handle the Multithreading environment?

If i have to use CreateProcess()/CreateThread(), how can i comunicate between the two threads?

Thanks ;)

like image 375
HyLian Avatar asked Jul 21 '26 05:07

HyLian


1 Answers

As for the system tray icon, you'll need Shell_NotifyIcon.

See http://msdn.microsoft.com/en-us/library/bb762159.aspx

like image 55
Raphaël Saint-Pierre Avatar answered Jul 23 '26 17:07

Raphaël Saint-Pierre