?
Solved

Network-mappings

Posted on 1998-04-22
1
Medium Priority
?
255 Views
Last Modified: 2010-04-06
Under W95 and NT4 i want to intercept changes in network-mappings. (lpt-mappings and drive-letter changes, you know, the NET USE - stuff).
How can i make my own-code launch when an other program changes such a mapping.
With a timer,  i currently check the mappings every few seconds, but this is time-consuming.

Any ideas ?
0
Comment
Question by:mvz121697
[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
1 Comment
 
LVL 5

Accepted Solution

by:
inter earned 100 total points
ID: 1336070
Hi,
The network connections are stored in the registry key(and sub keys in)
HKEY_CURRENT_USER\Network
for example if there is a mapped Z drive its info is in
HKEY_CURRENT_USER\Network\Z
You can automatically notified a change in the Network key and its all subkeys with
the following API:

LONG RegNotifyChangeKeyValue(
    HKEY hKey,      // handle of key to watch
    BOOL bWatchSubtree,      // flag for subkey notification
    DWORD dwNotifyFilter,      // changes to be reported
    HANDLE hEvent,      // handle of signaled event
    BOOL fAsynchronous       // flag for asynchronous reporting  
   );      
 
So the procedure is:
1 - Open the Network key and get its handle
2 - Create a Event object
3 - With keyhandle, bWatchSubtree = true and event handle call the above Api setting fAsynchronous = true.
4 - Create a thread just for watching the event, it should use WaitSingleObject to check if a mapping is changed
5 - If smth changed your thread is notified by Windows so do what you want,

Regards,(If you have trouble in programming this, I (or somebody else with this method) try to program, but I have no time by now)
Igor
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

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