Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Network-mappings

Posted on 1998-04-22
1
Medium Priority
?
257 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

618 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