none
屏幕锁定 RRS feed

  • 问题

  • 本人刚学C#,自学,找了一本软件开发的书,在电脑上编程,有很多地方不懂,求大神指教!!                                                                  屏幕锁定程序设置钩子中[DllImport("user32.dll")] public static extern int SetWindowsHookEx(int idHook,HookProc lpfn,IntPtr hInstance,int threadID)为什么显示HookProc未能找到,是缺少命名空间吗?该怎么改?求指教!

    
    2016年9月26日 13:53

答案

全部回复

  • Hi

    参考一下这个例子:

    MSDN HOW TO:在 Visual C# .NET 中设置窗口挂钩


    希望我的答案能帮助更多的人。

    2016年9月27日 1:52
  • Hi 闫晴

    根据你的描述,你也许缺一个类或者dll库。
    别人封装好的函数或类你调用时如果缺少相应类或组件就会提示这个信息

    你可以考虑添加引用或者试一下这段代码

    using System.Windows.FormsCommonDialog.HookProc
    语法:
    [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
    protectedoverride IntPtr HookProc(
    IntPtr hWnd, 
    int msg, 
    IntPtr wparam, 
    IntPtr lparam 
    )


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    2016年9月29日 12:28