Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ej25_SystemTray
- Ejemplo para demostrar como se puede usar el systemTray en las
- aplicaciones */
- #include <radc++.h>
- Form form1("Poner y cambiar el icono en System Tray - RAD C++ Ejemplo");
- Label label("Por favor hage click en el nuevo icono para agreagrlo a su bara de tareas System Tray (creado en este ejemplo), el cual cambiara el icono y el tooltip.",-1,0,0,300,50,form1);
- //Define 2 new objects of type Icon to hold our icons
- //NOTE: IDI_APPLICATION and IDI_EXCLAMATION are predefined by system
- Icon icon1(IDI_APPLICATION);
- Icon icon2(IDI_EXCLAMATION);
- //create procedure for form to receive events
- FormProcedure form1Proc(FormProcArgs) {
- ON_CLOSE() { //close applciation when form is closed
- form1.removeTrayIcon(); //remove the icon we set when quitting application
- Application.close();
- }
- ON_TRAYICON_CLICK(form1) { //check if the tray icon has been clicked
- //change the icon and the tooltip of icon that we set in system tray
- //first argument is the icon (icon2) and second is tooltip of icon in tray
- form1.resetTrayIcon(icon2,"Tray icon tooltip cambiado");
- //display a message box
- form1.msgBox("Note en el system tray! el icono que ha clickeado ha sido cambiado igualmente que el tooltip...");
- }
- return 0;
- }
- rad_main()
- //attach procedure to the form
- form1.procedure = form1Proc;
- //set the icon1 as system tray icon for this form
- //icon1 is the icon to be set and 2nd argument is the defualt tooltip
- form1.setTrayIcon(icon1,"Tray icon tooltip");
- label.center(); //center label in form
- rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement