Advertisement
idsystems

CPP_RAD_Ejercicio25

May 20th, 2012
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.59 KB | None | 0 0
  1. /* ej25_SystemTray
  2. Ejemplo para demostrar como se puede usar el systemTray en las
  3. aplicaciones */
  4. #include <radc++.h>
  5.  
  6. Form form1("Poner y cambiar el icono en System Tray - RAD C++ Ejemplo");
  7. 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);
  8.  
  9. //Define 2 new objects of type Icon to hold our icons
  10. //NOTE:  IDI_APPLICATION and IDI_EXCLAMATION are predefined by system
  11. Icon icon1(IDI_APPLICATION);
  12. Icon icon2(IDI_EXCLAMATION);
  13.  
  14. //create procedure for form to receive events                  
  15. FormProcedure form1Proc(FormProcArgs) {
  16.  
  17.     ON_CLOSE() { //close applciation when form is closed
  18.    
  19.         form1.removeTrayIcon(); //remove the icon we set when quitting application
  20.         Application.close();
  21.        
  22.     }
  23.    
  24.     ON_TRAYICON_CLICK(form1) { //check if the tray icon has been clicked
  25.        
  26.         //change the icon and the tooltip of icon that we set in system tray
  27.         //first argument is the icon (icon2) and second is tooltip of icon in tray
  28.         form1.resetTrayIcon(icon2,"Tray icon tooltip cambiado");
  29.        
  30.         //display a message box
  31.         form1.msgBox("Note en el system tray! el icono que ha clickeado ha sido cambiado igualmente que el tooltip...");
  32.        
  33.     }
  34.     return 0;
  35. }
  36.  
  37. rad_main()
  38.  
  39.         //attach procedure to the form
  40.         form1.procedure = form1Proc;
  41.        
  42.         //set the icon1 as system tray icon for this form
  43.         //icon1 is the icon to be set and 2nd argument is the defualt tooltip  
  44.         form1.setTrayIcon(icon1,"Tray icon tooltip");
  45.        
  46.         label.center(); //center label in form
  47.  
  48. rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement