Solved

Capture Network disconnect message

Posted on 2006-11-13
4
876 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 150 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

691 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