Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to set arguments for a DllCall: IsDestinationReachable()


  • Please log in to reply
7 replies to this topic
bluboy
  • Members
  • 3 posts
  • Last active: May 14 2008 06:14 PM
  • Joined: 08 May 2008
Using the "dllcall" function, I am trying to get the status of my internet connection by checking if a remote host is available. using the

"SENSAPI.DLL" s
"IsDestinationReachable" Function

Here is the msdn reference page on this:

http://msdn.microsof...851(VS.85).aspx



What should be the datatypes of the argument and return parameters. I have been trying to get this working for quite some time but haven't been able to do so..

This is as far as i have come
Result := DllCall("SENSAPI.DLL\IsDestinationReachable" ,"str", url)

A Small code snippet for an answer would be really really great !! :D

PS:
I have read the thread by SKAN which doesnt work for me

And also the one by Jordis regarding dll call return values.

[ Moderator!: MSDN link fixed ]

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
Here is some example code (VB)

I think you are better off using something like ping, but as a learning experience, ok... Tip: search for "structures" on the forum.

:)

HTH

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
MsgBox, % DllCall("SENSAPI.DLL\IsDestinationReachableA" , Str,"www.skan.in", Int,0 )    
MsgBox, % DllCall("SENSAPI.DLL\IsDestinationReachableA" , Str,"www.google.com", Int,0 )

:)

bluboy
  • Members
  • 3 posts
  • Last active: May 14 2008 06:14 PM
  • Joined: 08 May 2008
Thanks SKAN ;),

That did the job.. Hope to put my script here soon :)

To nlid

You cannot fetch the result of a "ping" from AHK, So it leaves me with only this to use..

However, it would be great to use output from command line :p

Z Gecko
  • Guests
  • Last active:
  • Joined: --
just to be a smartass:

To nlid

You cannot fetch the result of a "ping" from AHK, So it leaves me with only this to use..

is not true.
You can either pipe the output from the cmd-line to a file and read it then,
or you use this nice script by corrupt http://www.autohotke.../topic8606.html

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

To nlid

You cannot fetch the result of a "ping" from AHK, So it leaves me with only this to use..


url=www.skan.in
RunWait, ping.exe %url% -n 1,, Hide UseErrorlevel
If Errorlevel
   MsgBox,16,%url%, Destination Unreachable
Else   
   MsgBox,64,%url%, Destination Reachable

:)

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
It may be worth noting:

This function is not available on Windows Vista.

However, I did not get the expected return value, ERROR_CALL_NOT_IMPLEMENTED=0x78. I got FALSE, and I'm quite sure the destination was actually reachable...

bluboy
  • Members
  • 3 posts
  • Last active: May 14 2008 06:14 PM
  • Joined: 08 May 2008
SKANs script with "RUNWAIT" just does it for me :)
Thanks a lot or else i would be forever trying to use dllcalls for everything
"RunWait" is my command for the day and it was right in front of my eyes :roll: so reading the AHK Help Manual gets a priority hack and is @ #1 on my To-Do List .

@ Z- Gecko
My BAD :(
Correction Made

Cheers :lol: