I'm sorry for such an open-ended question, but I'm working backwards from a functional application that suddenly stopped working.
I'm using the following functionality to read Clipboard input on a personal windows forms application. For months and months I had no issues, and it recently started missing the messages. When I breakpoint within the switch statement case for WM_DRAWCLIPBOARD, 50% or more of the time, it doesn't hit - but some other times it does.
public partial class MyForm : Form
{
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer);
private void SocketClipboardListener()
{
_ClipboardViewerNext = SetClipboardViewer(this.Handle);
}
protected override void WndProc(ref System.Windows.Forms.Message m)
{
const int WM_DRAWCLIPBOARD = 0x308;
switch (m.Msg)
{
case WM_DRAWCLIPBOARD:
HandleClipboardStuff(); // This has been working - WHEN it receives the message!
break;
}
}
}
I'm unsure what to read up on or look into to resolve this; it just doesn't seem to be getting all of the system messages (reminder, it did a few days ago!)
Could this just be something with high CPU/Memory utilization, getting in the way of system messages? Or is there something I should ID in my code? Is there a better way to register/read clipboard input?
This very much seems like - if my code was some train-rails, I've only been adding destinations, but the train's been de-railing as soon as it takes off!
Thank you for any input you all have, before-hand. Like I said, 50% of the time it gets the message anyways, so it's viable right now, just not perfect!