Click here to Skip to main content
15,884,099 members
Articles / Programming Languages / C++

Detecting Hardware Insertion and/or Removal

Rate me:
Please Sign up or sign in to vote.
4.88/5 (86 votes)
19 Jun 20066 min read 830.5K   33.3K   333  
A user-mode application to detect hardware add/remove with WM_DEVICECHANGE and RegisterDeviceNotification()
<html>
<head>
<META HTTP-EQUIV="Content-Type" content="text/html; charset=big5">
</head>
<body>
<pre>
<table width=100% bgcolor=#CFCFE5><tr> <td> <font face=arial size=+3>
Build Log
</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>
<h3>------- Build started: Project: HWDetect, Configuration: Release|Win32 -------
</h3>
</pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
Command Lines
</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>This edition of Visual C++ does not support the optimizing compiler.
Creating temporary file "c:\Dev\HWDetect\Release\RSP000001.rsp" with contents
[
/D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_AFXDLL" /D "_MBCS" /FD /EHsc /MD /GS /Zc:wchar_t /Yu"stdafx.h" /Fp"Release/HWDetect.pch" /Fo"Release/" /Fd"Release/vc70.pdb" /W3 /c /Wp64 /Zi /TP
.\HWDetectDlg.cpp
.\HWDetect.cpp
]
Creating command line "cl.exe @c:\Dev\HWDetect\Release\RSP000001.rsp /nologo"
Creating temporary file "c:\Dev\HWDetect\Release\RSP000002.rsp" with contents
[
/D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_AFXDLL" /D "_MBCS" /FD /EHsc /MD /GS /Zc:wchar_t /Yc"stdafx.h" /Fp"Release/HWDetect.pch" /Fo"Release/" /Fd"Release/vc70.pdb" /W3 /c /Wp64 /Zi /TP
.\stdafx.cpp
]
Creating command line "cl.exe @c:\Dev\HWDetect\Release\RSP000002.rsp /nologo"
Creating command line "rc.exe /d "NDEBUG" /d "_AFXDLL" /l 0x409 /I "Release" /fo"Release/HWDetect.res" .\HWDetect.rc"
Creating temporary file "c:\Dev\HWDetect\Release\RSP000003.rsp" with contents
[
/OUT:"Release/HWDetect.exe" /INCREMENTAL:NO /NOLOGO /DEBUG /PDB:"Release/HWDetect.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /MACHINE:X86 Setupapi.lib
.\Release\HWDetect.obj
.\Release\HWDetectDlg.obj
.\Release\stdafx.obj
.\Release\HWDetect.res
]
Creating command line "link.exe @c:\Dev\HWDetect\Release\RSP000003.rsp"
</pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
Output Window
</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>Compiling...
stdafx.cpp
Compiling...
HWDetectDlg.cpp
HWDetect.cpp
Generating Code...
Compiling resources...
Linking...
LINK : warning LNK4089: all references to 'OLEAUT32.dll' discarded by /OPT:REF
</pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
Results
</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>
Build log was saved at "file://c:\Dev\HWDetect\Release\BuildLog.htm"
HWDetect - 0 error(s), 1 warning(s)</pre></table><table   width=100% height=20 bgcolor=#CFCFE5><tr><td><font face=arial size=+2>
</font></table></body></html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Hong Kong Hong Kong
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions