Sign in to follow this  
Followers 0
friends

Is Network Alive - Not working in Win2000

10 posts in this topic

Hi all. I don't remember who actually wrote this script.

However.... I loved it very much and find it very useful

for me to implement it with my script.

It works fine with WinXP, but not Windows 2000 (SP4).

I wonder if someone can fix it.... so that it works well

in Win2000.

Thanks for the help.

Here's the coding.... (Credit: Thanks to the script writer)

; 1 means alive
; 0 means disconnect

WHILE 1
  ;DLLOpen ("SENSAPI.dll")
   
   $x = DLLCall ("SENSAPI1.dll","int","IsNetworkAlive")
   
   msgbox (4096,"TEST",$x[0], 3)
   
   IF $x[0] = 0 THEN 
      MsgBox (0, "", "Kindly contact MIS !", 3)
   ELSE 
       MsgBox (0, "", "Network is alive !", 3)
   ENDIF 
    
  ;DLLClose ("SENSAPI.dll")
WEND

Share this post


Link to post
Share on other sites



Works for me (Windows 2000 SP3). I changed "SENSAPI1.DLL" to "SENSAPI.DLL" in the DLLCall. Maybe that was the problem - you've incorrectly referenced the DLL?

cheers

ben

Share this post


Link to post
Share on other sites

Works for me (Windows 2000 SP3). I changed "SENSAPI1.DLL" to "SENSAPI.DLL" in the DLLCall. Maybe that was the problem - you've incorrectly referenced the DLL?

cheers

ben

<{POST_SNAPBACK}>

Oh yaa.... thanks for the notification.

How careless I am.... I didn't notice that there is "1" at the back

of the DLL file.... :">

thanks dude.... I think it should work now !

Share this post


Link to post
Share on other sites

Oh yaa.... thanks for the notification.

How careless I am.... I didn't notice that there is "1" at the back

of the DLL file....  :">

thanks dude.... I think it should work now !

<{POST_SNAPBACK}>

I've tested it out on Win2000 SP4, it really does not work !

kindly see the attached file.....

anybody knows how to fix this ?

Thanks

Share this post


Link to post
Share on other sites

I've tested it out on Win2000 SP4, it really does not work !

kindly see the attached file.....

anybody knows how to fix this ?

Thanks

<{POST_SNAPBACK}>

$x = DLLCall ("SENSAPI1.dll","int","IsNetworkAlive")

acccording to MSDN, IsNetworkAlive needs a parameter. MSDN Link, so use this (untested):

const $NETWORK_ALIVE_LAN 0x00000001     
const $NETWORK_ALIVE_WAN 0x00000002
const $NETWORK_ALIVE_AOL 0x00000004

$flags = $NETWORK_ALIVE_LAN 
$x = DLLCall ("SENSAPI1.dll","int","IsNetworkAlive","long", $flags)

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

$x = DLLCall ("SENSAPI1.dll","int","IsNetworkAlive")

acccording to MSDN, IsNetworkAlive needs a parameter. MSDN Link, so use this (untested):

const $NETWORK_ALIVE_LAN 0x00000001     
const $NETWORK_ALIVE_WAN 0x00000002
const $NETWORK_ALIVE_AOL 0x00000004

$flags = $NETWORK_ALIVE_LAN 
$x = DLLCall ("SENSAPI1.dll","int","IsNetworkAlive","long", $flags)

Cheers

Kurt

<{POST_SNAPBACK}>

Sorry... the code given does not work.

I'm not familiar with the DLLCALL stuffs yet.... I hope someone

could give me a working example for this.

Please see the error message.

Thank you.

Share this post


Link to post
Share on other sites

What that means is do this to the code... add an equal sign (=).

const $NETWORK_ALIVE_LAN = 0x00000001    
const $NETWORK_ALIVE_WAN = 0x00000002
const $NETWORK_ALIVE_AOL = 0x00000004

$flags = $NETWORK_ALIVE_LAN
$x = DLLCall ("SENSAPI1.dll","int","IsNetworkAlive","long", $flags)

Try to learn. Dont just ask for someone to use their time for your cause. I cant believe you didnt get that error. Had absolutely nothing to do with the DLLCall() function.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Can someone please help me up with the network detection for Windows 2000 SP4 ?

I had tried out the script given, it didn't work out.

I need this to detect if the network is established or not.

Hope someone will help me up with this.

Thanks in advance

Share this post


Link to post
Share on other sites

If I recall this can be done with WMI.

I forget where but search the forums or find it on http://msdn.microsoft.com/library/default....i_reference.asp

you may also be able make your own UDF to accomplish what you want

something without com or dllcalls

somthing like

If @ipaddress1 <> "0.0.0.0" AND @ipaddress1 <> "127.0.0.1" Then
     MsgBox( 48, "Network Status", "Network Connection Up")
Else
     MsgBox( 48, "Network Status", "Network Connection Down")
EndIf

I havent tested that but I cant think why it shouldnt work.

But you learning how to do WMI or DLLcalls and writing your own script would be a better answer.


Share this post


Link to post
Share on other sites

What resource are you trying to reach on the network?

If you test for that, maybe I can help.

There have been multiple threads on detecting accessibility of a network drive.

J


If I am too verbose, just say so. You don't need to run on and on.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0