.net类库和api mfc有什么区别呀??
发布网友
发布时间:2022-05-26 05:15
我来回答
共2个回答
热心网友
时间:2024-08-17 11:32
.NET类库是Framwork组件中安装的类库,只针对.NET有效。
api是操作系统system32根目录下的自带的动态链接库,简称应用程序编程接口,他是针对所有应用程序的,不仅仅是哪一门语言哪一种程序。
mfc是微软基础类库,以C++类的形式封装了Windows API,是C++量身定做的类库。
举例说明,对于窗体的拖动,假设我建立一个没有边框的窗体,怎么拖动它像拖动WINDOWS窗口一样不闪烁不重绘不花屏:
C#使用.NET API办法:
[DllImport("user32.dll", EntryPoint = "ReleaseCapture")]
public static extern void ReleaseCapture();
[DllImport("user32.dll", EntryPoint = "SendMessage")]
public static extern void SendMessage(int hwnd, int wMsg, int wParam, int lParam);
#endregion
private void panelForm_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage((int)this.Handle, 0xA1, 2, 0);
}
}
VB使用API方法:
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_SYSCOMMAND = &H112
Private Const SC_MOVE = &HF010&
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0
End Sub
C++就简单了:
DefWindowProc(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
热心网友
时间:2024-08-17 11:33
.net需要运行庠