怎么添加 user32.dll 引用

谁学逆向工程 2015-05-14 10:16:35
我已经把 user32.dll 复制到当前文件夹里了
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Drawing.Printing;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;

class AntiAlias : Form
{
public static void Main()
{
Application.Run(new AntiAlias());
}
public AntiAlias()
{
Text = "Anti-Alias Demo";
BackColor = SystemColors.Window;
ForeColor = SystemColors.WindowText;
}
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
[DllImport(user32.dll)]
public static extern int ScrollWindow(IntPtr hwnd,int cx, int cy,
ref RECT rectScroll,
ref RECT rectClip);
}

错误 1 当前上下文中不存在名称“user32” C:\Users\hrao\Desktop\Project1\Project1\InheritHelloWorld.cs 29 15 Project1
...全文
571 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
loveclk 2015-05-14
  • 打赏
  • 举报
回复
[DllImport("user32.dll")]
鏡椛氹鈅 2015-05-14
  • 打赏
  • 举报
回复
http://www.cnblogs.com/goed/archive/2011/11/10/2243965.html 首先[DllImport(user32.dll)]是错误的应该是[DllImport("user32.dll")]

110,529

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧