![]() |
Support eCharcha.Com. Click on sponsor ad to shop online! |
|
#1
|
|||
|
|||
|
I have to put WebBrowser control on a form and using the timer event control, I have to bascilly check for an intranet web page status… if for some reason webpage is not available then I have to make a log…
Any ideas how to achieve this using VB6 and standard controls like webbrowser! ??
__________________
Statistics are like a bikini. What they reveal is suggestive, but what they conceal is vital. ---Not Me! |
|
#2
|
||||
|
||||
|
This is totally untested code off the top of my head, but it should be more or less correct.
Code:
Dim oFoo as InternetExplorer.Application
Set oFoo = CreateObject("InternetExplorer.Application")
' Navigate to site. Note that the URL is misspelled in code to avoid legal problems! Change it as needed!
oFoo.Navigate2 "www.ya-who.com"
' Gotta wait while the IE component is working!
While oFoo.Busy
Wend
' Grab the document and then deallocate the IE object when we're done grabbing the document text.
sString = oFoo.Document.Body.InnerHTML
' Deallocate our IE object now
set oFoo=Nothing
__________________
"Pick up your balls and load up your cannon For a twenty-one gun salute." -- For Those About To Rock (We Salute You) Proud LLKC member since May 2002. "We've been looking for the enemy for some time now. We've finally found him. We're surrounded. That simplifies things." Lt. Gen. Lewis "Chesty" Puller, USMC, Chosin Reservoir 1950
|
|
#3
|
||||
|
||||
|
Simple .......Format your Windoze box......Install Solaris on Intel ..........Write a shell script to do a HTTP GET ......put the script in Crontab .......Man MS makes $$$$$ making simple stuff look complicated with Controls and what not
![]()
__________________
Once my processor is rented cycles in Korea, my RAM is in orbit, and my storage media is distributed in 10K chunks all over the former Soviet Union, and there is no noticable performance hit. Then I'll have enough bandwidth. http://www.vinod.us http://www.storagedimensions.us |
|
#4
|
||||
|
||||
|
Why put it in the cron?? You can simply run an infinite process with sleep times in between.
__________________
Having a smoking section in a restaurant is like having a pissing section in a pool! |
|
#5
|
||||
|
||||
|
I agree biggie.. better yet.. hire a newbie to fire it off for you at $ prompt at regular intervals.. That way you will also be giving employment to an otherwise useless bum.
__________________
GpeL a day Keeps mischief away. |
|
#6
|
|||
|
|||
|
Guns bro,
Actully we have our intranet site, the purpose of this tool is to check if it is up and running or not! Lets say after each hour I have to check if the intranet site is available or not!!! parsu bhai kis zamane ki baat kar rahe ho .NET framework is on the way for unix ![]()
__________________
Statistics are like a bikini. What they reveal is suggestive, but what they conceal is vital. ---Not Me! |
|
#7
|
||||
|
||||
|
SimpleHuman sir, that's why I posted the above code. You can use it to hit a specific page on your intranet site and check if the sString contains the expected message or not. If the expected message is not received, then you can add a little more code to e-mail the necessary people.
Then all you have to do is schedule the program to run every hour or so. If you're running this program on a Windows NT, Win2K or WinXP machine, you can do this by using the Scheduler from the control panel. If you want to be macho about it and use the command line, all you have to do is research the AT command (type help at at the command prompt). ![]() If you're using a *NIX system, you might as well save some time and install Big Brother, which is (a) free for non-commercial use, (b) features a webpage that you can hit to query the health of all your servers and (c) works pretty well! As for running tasks on an infinite loop vs. running tasks from a crontab, I prefer the crontab method personally. Reason: I've had too many sysadmins get mad at me for leaving perl scripts running after I've logged off. It's all ok if you're running your own servers, but sysadmins generally tend to take a dim view of processes running for infinite time and usually kill such processes.
__________________
"Pick up your balls and load up your cannon For a twenty-one gun salute." -- For Those About To Rock (We Salute You) Proud LLKC member since May 2002. "We've been looking for the enemy for some time now. We've finally found him. We're surrounded. That simplifies things." Lt. Gen. Lewis "Chesty" Puller, USMC, Chosin Reservoir 1950
Last edited by GunsNRoses; September 17th, 2002 at 05:58 AM. |
|
#8
|
|||
|
|||
|
Guns bro,
I did try to use your code, but even if i pass wrong non existing site, the sstirng gives me value in retrun... so its kind of tuff to make a judgement about if the site is active or not??? Any other option??? anything in Java???
__________________
Statistics are like a bikini. What they reveal is suggestive, but what they conceal is vital. ---Not Me! |
|
#9
|
||||
|
||||
|
SimpleHuman Sir, I didn't say sString would not be populated. In fact, if you hit a non-existent website, it'll contain the HTML code that effectively says "Site not found". What you need to do is get the code to retrieve a known page on your intranet (even something that prints something simple as "I'm ok" will do). Then you can compare sString against that known text. If the message in sString is not the same as what you were expecting, then you can get the program to start e-mailing people.
[edit] BTW the first declaration should be: Dim oFoo As InternetExplorer Also don't forget to add Microsoft Internet Explorer to your project references (Menu: Project ---> References) [/edit]
__________________
"Pick up your balls and load up your cannon For a twenty-one gun salute." -- For Those About To Rock (We Salute You) Proud LLKC member since May 2002. "We've been looking for the enemy for some time now. We've finally found him. We're surrounded. That simplifies things." Lt. Gen. Lewis "Chesty" Puller, USMC, Chosin Reservoir 1950
Last edited by GunsNRoses; September 17th, 2002 at 06:08 AM. |
|
#10
|
|||
|
|||
|
oke let me try!
about email, do i have to use any third party control?
__________________
Statistics are like a bikini. What they reveal is suggestive, but what they conceal is vital. ---Not Me! |
|
#11
|
|||
|
|||
|
Quote:
the method of ur interest is here: http://java.sun.com/products/jdk/1.2...etResponseCode() u will have to schedule the ping in any case |
|
#12
|
||||
|
||||
|
You can use the CDONTS control, if you have it installed (it comes along with IIS and a couple of other Micro$oft products). You can search google for "CDONTS install" for more info. You may also be able to control Microsoft Outlook from VB to send your messages. If not, there are several third party Active-X controls. Also, you can write your own version in Visual C++, if you're inclined to hack your own control. Personally, I use Delphi or C++ Builder most of the time for Windows Development and they already come with a native Mail control (and there are also several third party controls available for free
).
__________________
"Pick up your balls and load up your cannon For a twenty-one gun salute." -- For Those About To Rock (We Salute You) Proud LLKC member since May 2002. "We've been looking for the enemy for some time now. We've finally found him. We're surrounded. That simplifies things." Lt. Gen. Lewis "Chesty" Puller, USMC, Chosin Reservoir 1950
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Any C++ gurus | dirty | Computing | 1 | August 27th, 2007 06:35 PM |
| Calling all *nix Gurus | style bhai | Computing | 11 | October 21st, 2006 09:20 AM |
| ShoutOut to the C++ Gurus | JaiSpeaks | Computing | 1 | March 9th, 2005 12:37 PM |
| Linux Gurus, Pls Help me.. | viruss | Computing | 3 | October 6th, 2004 11:27 PM |
| LoadRunner help - QA gurus please help | echarcha | SoapBox | 2 | October 25th, 2002 09:41 AM |