AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to set arguments for a DllCall: IsDestinationReachable()

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
bluboy



Joined: 08 May 2008
Posts: 3

PostPosted: Thu May 08, 2008 8:36 am    Post subject: How to set arguments for a DllCall: IsDestinationReachable() Reply with quote

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.microsoft.com/en-us/library/aa376851(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
Code:
Result := DllCall("SENSAPI.DLL\IsDestinationReachable" ,"str", url)


A Small code snippet for an answer would be really really great !! Very Happy

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 ]
Back to top
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Thu May 08, 2008 9:43 am    Post subject: Reply with quote

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.

Smile

HTH
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 5721

PostPosted: Thu May 08, 2008 10:09 am    Post subject: Reply with quote

Code:
MsgBox, % DllCall("SENSAPI.DLL\IsDestinationReachableA" , Str,"www.skan.in", Int,0 )   
MsgBox, % DllCall("SENSAPI.DLL\IsDestinationReachableA" , Str,"www.google.com", Int,0 )


Smile
Back to top
View user's profile Send private message
bluboy



Joined: 08 May 2008
Posts: 3

PostPosted: Fri May 09, 2008 6:00 am    Post subject: Reply with quote

Thanks SKAN Wink,

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

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 Razz
Back to top
View user's profile Send private message
Z Gecko
Guest





PostPosted: Fri May 09, 2008 6:58 am    Post subject: Reply with quote

just to be a smartass:
Quote:
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.autohotkey.com/forum/topic8606.html
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 5721

PostPosted: Fri May 09, 2008 8:43 am    Post subject: Reply with quote

bluboy wrote:
To nlid

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


Code:
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


Smile
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2492
Location: Australia, Qld

PostPosted: Fri May 09, 2008 9:24 am    Post subject: Reply with quote

It may be worth noting:
MSDN\IsDestinationReachable wrote:
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...
Back to top
View user's profile Send private message
bluboy



Joined: 08 May 2008
Posts: 3

PostPosted: Wed May 14, 2008 8:18 pm    Post subject: I Hereby Accept That im a n00b Reply with quote

SKANs script with "RUNWAIT" just does it for me Smile
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 Rolling Eyes so reading the AHK Help Manual gets a priority hack and is @ #1 on my To-Do List .

@ Z- Gecko
My BAD Sad
Correction Made

Cheers Laughing
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group