I am trying to add drive detection to my program but I am having a bit of difficulty. When I try to use the code specified on this code project. I am currently using windows for my project and I am having trouble getting it working.
namespace Project
{
public partial class MainWindow : Window
{
OTHER CODE
private const int WM_DEVICECHANGE = 0x219;
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_DEVICECHANGE:
// The WParam value identifies what is occurring.
// n = (int)m.WParam;
break;
}
base.WndProc(m);
}
}
}
For WndProc I need to have using System.Windows.Forms; but I also have using System.Windows.Controls; which gives me the following error
is an ambiguous reference between 'System.Windows.Controls.MenuItem' and 'System.Windows.Forms.MenuItem'
For base.WndProc(m); I get the error:'System.Windows.Window' does not contain a definition for 'WndProc'
and protected override void WndProc(ref Message m) gives the error: 'Project.MainWindow.WndProc(ref System.Windows.Forms.Message)': no suitable method found to override
I am clearly doing something really wrong but not sure what