Solved

Capture Network disconnect message

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Downloading email attachments 2 95
Delphi 2 90
Add New Database Table in database file using delphi 3 54
Firemonkey how to swip panel with finger tap 1 40
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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

732 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