Forum > Windows

[Solved] Detecting new Network Connection setup !

(1/1)

loaded:
Hi All,
Is there a message in the windows operating system that we can catch when a new network connection is established, to detect it?
Or do we have to manually control it ourselves in the timer ?

440bx:

--- Quote from: loaded on August 11, 2022, 01:11:54 pm ---Is there a message in the windows operating system that we can catch when a new network connection is established, to detect it?

--- End quote ---
TTBOMK, there is no such message.


--- Quote from: loaded on August 11, 2022, 01:11:54 pm ---Or do we have to manually control it ourselves in the timer ?

--- End quote ---
Yes, I believe that is the only way. (unless the program itself is creating a new connection.)

ccrause:
As 440bx mentioned, there isn't a simple message.

Next best is to look at Receiving Notification of Network Events.  NotifyAddrChange will notify you when something in the network setup has changed.  Then use GetIPAddrTable to figure out what changed.  Not simple, but at least you only have to check for a new IP address when a network change notification is received.

loaded:
Thank you very much for your answers 440bx and ccrause
Good to know NotifyAddrChange. I think I can get out of this point and reach the point I want. Respects.


When I went to point NotifyAddrChange I found an earlier post. For now this solution solved my problem.
https://forum.lazarus.freepascal.org/index.php/topic,49350.msg357495.html#msg357495

Navigation

[0] Message Index

Go to full version