?
Solved

Capture Network disconnect message

Posted on 2006-11-13
4
Medium Priority
?
880 Views
Last Modified: 2012-08-13
Hi Experts,

I need to capture network disconnection event (network cable unplugged). What windows message is responsible for that event?

Sincerely,
odissey1
0
Comment
Question by:odissey1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Author Comment

by:odissey1
ID: 17935188
Hi Experts,

Sorry, again. Just to make my problem clear, I am looking for the fastest method to detect that connection is not awailable. The problem is that I am saving data on the networked drive and Application deadlocks if network is suddenly disconnected. For example procedure

if  DirectoryExists('\\remote_computer\some_folder') then...

hangs up my application as well (no exception posted). Seems like WinXP keeps thinking for some time that it is still connected and tries to access a remote folder...

Regards,
odissey1
0
 
LVL 10

Expert Comment

by:wildzero
ID: 17935516
Not sure if it would be the fastest way, but perhaps a ping function to check?

ie

If ConnectionExists = true then
  //do something
else
  //connection lost


Function ConnectionExists : boolean;
Begin
  Try
    Ping Computer, if ping completes then
     Result := true
   else
     Result := false
  except
    Result := false;
  end;
end;

Not sure how well that'd work though.

0
 
LVL 9

Accepted Solution

by:
sun4sunday earned 450 total points
ID: 17935624
how to check whether you are connected to the Internet
http://delphi.about.com/cs/adptips2000/a/bltip1100_4.htm

Also check this PAQ http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21237093.html  from Russel

Other way is You can do that with try catch event.When you try to connect to the network and the connection not exists it will throw the error. Capture the right error and and show the user.

sun4sunday
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question