How to receive Plug & Play device notifications without a windows form

You’ll need a window, there’s no way around that. Here’s a sample implementation. Implement an event handler for the DeviceChangeNotifier.DeviceNotify event to get notifications. Call the DeviceChangeNotifier.Start() method at the start of your program. Call DeviceChangeNotifier.Stop() at the end of your program. Beware that the DeviceNotify event is raised on a background thread, be sure … Read more

Best method for storing this pointer for use in WndProc

This question has many duplicates and almost-duplicates on SO, yet almost none of the answers I’ve seen explore the pitfalls of their chosen solutions. There are several ways how to associate an arbitrary data pointer with a window, and there are 2 different situations to consider. Depending on the situation, the possibilities are different. Situation … Read more

How to handle WndProc messages in WPF?

You can do this via the System.Windows.Interop namespace which contains a class named HwndSource. Example of using this using System; using System.Windows; using System.Windows.Interop; namespace WpfApplication1 { public partial class Window1 : Window { public Window1() { InitializeComponent(); } protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); HwndSource source = PresentationSource.FromVisual(this) as HwndSource; source.AddHook(WndProc); } private … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)