我的代码运行5-10分钟后,我不断收到此错误
检测到CallbackOnCollectedDelegate消息:对类型为"CashRecyclerTestapp!MessageMonitor + NativeMethods + WndProc :: Invoke"的垃圾回收委托进行了回调.这可能会导致应用程序崩溃,损坏和数据丢失.将委托传递给非托管代码时,托管应用程序必须将它们保持活动状态,直到确保它们永远不会被调用.
我正在写一个自动售货机应用程序,我有一个DLL发布我需要在我的应用程序中捕获的消息
这是我的代码我从互联网上获取源代码来捕获消息,它在这里不断收到错误
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
using System.Threading;
/// <summary>
/// Event handler for the <see cref="MessageMonitor.MessageReceived"/> event.
/// </summary>
/// <param name="hwnd">Handle to the window procedure that received the message.</param>
/// <param name="message">Specifies the message.</param>
/// <param name="wParam">Specifies additional message information. The content of this parameter depends on the value of the Msg parameter.</param>
/// <param name="lParam">Specifies additional message information. The …Run Code Online (Sandbox Code Playgroud)