Use visual basic to send colour message over the LAN

I am currently writing an application in visual basic that updates real-time data on our intranet, but what I need to be able to do is to send an alert message to one of our users if the data goes above or below a certain value, so that they can check the web page.  The web page is not always open, so I need it to work through something like the messenger service, although I'm not sure how to add the colour part.

If the value goes over a certain amount I need the alert to appear in blue and if the alert goes below a certain amount I need the alert to appear as red.

Is there any way of doing this through visual basic?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wouldn't an email message be better?  Messenger service pop ups can be dismissed without the user even reading it.  Plus you can provide a link in the email making it easier for the user.  And you will have a records of the message being sent - the user will have records of having recieved it.
barnesaAuthor Commented:
The user receives about 100-200 a day and he has said that he doesn't want to receive it as an email.

I am getting around the problem just now by using the net send command in visual basic, but net send doesn't have the capabilities to send the message as coloured text or with a coloured background and it can only send off the message one at a time.
Here's an idea . . Have a VB program run on the Client's computer.  Have IT do the reads / logic / whatever that will decide whether to tell him about it.
Then you can send pop ups on his local machine.  you will have more control over appearance this way.  For example if you can't get MsgBox to be in color (no idea if you can)  Than have 2 different forms with different colors and show the forms with an OK box.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

u can use winsock control to send data over network.

this data can then be parsed as required.
for example using the winsock control:

<red>msg...oh my god...</red>

have vb then read and parse each msg and display each msg in its specified color.

* using winsock you can send any type of data. for example send 3 bytes to describe 3 status like:
1st byte = critical
2nd byte= permanent
3rd byte = ignore

or u can send 1 byte using its bits saving bandwidth and space... (if your familiar with the binary and bit system)
another way will be to use psexec to invoke a webpage on the user's pc the webpage can have the message in what ever colour you want.
psexec \\<machinename> -i cmd.exe /c start

you need the admin previlages on that machine. you can provide the username and the password in the command line too.

you can download psexec from its a freeware
barnesaAuthor Commented:
I should have said at the start that the user has about 700 rows on the webpage so the alert needs to say:

1) what row has been affected.
2) what the value has now changed to
3) the text in red if the value has gone down
4) the text in blue if the value has gone up

I am currently using net send to tell him what row has been affected and what the new value is, but I can't send the text in red/blue colour with a net send command.
you can open the page by sending accross an url with # and the bookmark of javascript so that the page will automatically show the selected row.
like takes you to your answer
barnesaAuthor Commented:
Although the user has to go into the webpage and look at the details, he does not want the webpage popping up in any shape or form to show him the alert.

Is there any programs/vb out there that allows an user to see the value like a net send command prompt but with the text in colour?  
Not that I know of - or anyone else participating in this thread evidently.  This is why were offering all these alternatives.

Here's one more:

The user wants a quick visual clue as to whether a value goes up or down.  what if you just put the word UP or DOWN or somthing like that INCREASE DECREASE whatever in all caps - they should see it right away - same net effect as the colors I guess.
Or . . . Does the client use Instant Messenger or ICQ or something like that?  Maybe you could send him a message using that . .  Not sure how to do it but I'm sure it wouldn't be that difficult.

OR  . . . yet another solution.  . . Program a new web page that summarizes changes - print your changes in red or blue and make it flexible for the user - show the last 20, last 50.

I can't imagine that your user is so particular that they must have a pop up message come up on their computer and that it must be blue or red or whatever.

Yet another suggestion:  Write a client program to reside on the client computer, Have it recieve messages from the other program and have it display the popup - this way you could make the pop ups look however you want.
if he doesnt want the webpage popping up is it ok for him to get the message in a browser window? if yes use DCOM to invoke a browser and write to the DOM of the browser if its ok tell me i'll provide the code.
barnesaAuthor Commented:
Hi bhagyesht

I have spoken to the person and he is happy with getting the message in a browser window on his screen.
ok copy and paste the code below into a text file rename the file with a vbs extention

now on the computer where u wish to show the message goto start menu->run and run the dcomcnfg.exe A window will appear.
in the application tab select Internet explorer and click on properties button now go to the identity tab and select interactive user. save ur changes by clicking ok and closing the application.

now run the script you shall get the message on the computer

make appropriate changes as required ie call using the proper computername, colorname and message

'code begins
call ShowMessage(<Computername>,<color>,<message>)

function ShowMessage(strComputerName,strColor,strMessage)
      Dim IE
      Set IE = CreateObject("InternetExplorer.Application",strComputername)
      IE.navigate "about:blank"
      'wait a while until IE as finished to load
      Do while IE.busy
      Do While UCase(IE.Document.readyState) <> "COMPLETE"
            WScript.Sleep 100
      IE.document.write("<head><title>New Message for you</title></head>")
      IE.document.write("<body bgcolor=" + strColor + " >" + strMessage + "</body>")
      set IE=nothing
end function

'code ends
barnesaAuthor Commented:
bhagyesht, this bit of code is brillant and it is exactly what I need.

The only problem I have got is that I can get it to run on the local computer perfectly, but when I try to send it to the remote computer it keeps coming back with permission denied.

I have checked the dcomcnfg and that is configured properly as per you instructions above on the remote computer, any other things that might be stopping it from working on the remote machine.
first before executing the code you need to login to the machine using the username and password of the user thats logged in you can do so by using the net command assuming the username is abcd and the password is defg you can login to the machine by the following piece of code.
this is because we need to run the program in the active client's desktop

' code starts
      Dim WshShell
      Set WshShell = CreateObject("WScript.Shell")
      WshShell.Run "cmd /c net use \\<computername> /USER:abcd defg",0,true
      set WshShell=nothing
' code ends

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
barnesaAuthor Commented:
I have added the code in with the correct computername, username and password but it keeps coming back with permission denied on the following line:

     Set IE = CreateObject("InternetExplorer.Application", strComputerName)

It only seems to want to run it on the local machine
are u able to browse to the computer? ie through your windows explorer try browsing once you run
net use
barnesaAuthor Commented:
I am able to browse to the computer's c$ share as the computer I am using is a domain administrator

The code runs ok and displays the message on the other computer when the 2 machines are both logged in as the same user account.  I have tried running the wsHSell.Run command below from the dos prompt and that returns the commands has completed successfully

cmd /c net use \\<computername> /USER:<user> <pass>

I assume both the OS are win2k right?
one silly question: are u using the username as that who is logged in on the remote computer?
ie if userA has logged on to computer1 and you have logged on to computer2 as userB from computerB you want to run the program your command would be
cmd /c net use \\computer1 /USER:userA userAPassword
barnesaAuthor Commented:
Yes both the OS are win2k and I am doing as you say about using the currently logged in user's details on the remote machine as part of the script.
barnesaAuthor Commented:
bhagyesht, thanks for your help with this.

I have managed to get this to work on both the machines with the win2k systems now, I wasn't giving the code enough time to log into the remote computer.

Do you know if this code works with windows nt as well, the reason for this is so that I can script the code to alert on a different screen at weekends that runs windows nt workstation?
it should work on 98 and windows nt 4.0 with the latest service pack. 95 will require DCOM98 to be installed and IE5.5 onwards
Glad could help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.