Send WinPopUp messages trought the net  

Send By: Radikal (Q3 Team)
Web : http://www.q3.nu
Email: radikal@q3.nu
Date: 04/03/00

Tip accessed 714 times

 


I don't know if you will know the program WinPopUp of Windows...
It allows to send small emergent messages to other computers of the net.
If you don't know it... test it, you must only execute it and it will remains listening.
If a message arrives... it emerges to show it to you.
With the function that I put you in this trick, you will be able to send messages of this type that will activate this program (WinPopUp) in another computer connected in your net.


 procedure TForm1.Button1Click(Sender: TObject);

   procedure MandaWinpopup( ServidorRemoto,
                            Destinatario,
                            Remitente,
                            Mensaje : String);
   var
     sTemp   : string;
     Mango   : THandle;
     Cuantos : DWord;
   begin
     sTemp := '\\'+ServidorRemoto+'\mailslot\messngr';

     Mango := CreateFile( PChar(sTemp),
                          GENERIC_WRITE,
                          FILE_SHARE_READ,
                          NIL,
                          OPEN_EXISTING,
                          FILE_ATTRIBUTE_NORMAL,
                          0);

     If Mango = INVALID_HANDLE_VALUE then
       raise Exception.create( 'Error abriendo el slot'+#13+
                               'Error opening the slot');

     sTemp:=Remitente+#0+Destinatario+#0+Mensaje;
     try
       Cuantos := 0;
       If (NOT WriteFile(Mango,
                         Pchar(sTemp)^,
                         Length(sTemp),
                         Cuantos,
                         NIL)) or
          (Cuantos <> Length(sTemp)) then
          raise Exception.create( 'No puedo mandar el mensaje'+#13+
                                  'Cannot send the message');
     finally
       CloseHandle(Mango);
     end;
   end;

 begin
   MandaWinpopup( 'Maria',           {Remote PC}
                  'Para Periko',     {Message Receiver}
                  'De Manolo',       {Message Sender}
                  'Invitame a un cafe...');  {Message text}

 end;