Windows API 函数学习环境的搭建
- C/C++编程:推荐VS系列
- 中文编程:易语言
- 谷歌浏览器
- MSDN https://msdn.microsoft.com/library/
什么是Windows API
Windows系统是一个很大的服务中心,调用这个服务中心的各种服务(每一种服务就是一个函数),可以帮应用程式达到开启视窗、描绘图形、使用周边设备等目的,由于这些函数服务的对象是应用程序(Application),所以便称之为Application Programming Interface,简称API函数。
WIN32API也就是Microsoft Windows32位平台的应用程序编程接口。
Windows API就是Windows应用程序接口,是针对Microsoft Windows操作系统家族的系统编程接口,这样的系统包括Windows几乎所有版本。其中32位Windows操作系统的编程接口称为Win32 API以便与以前16位版本Windows编程接口(16位Windows API)区别开来。
应用层编程中 win32api 内核层win64api
函数分类
Windows API包括几千个可调用的函数,它们大致可以分为以下几个大类:
- 基本服务
- 组件服务
- 用户界面服务
- 图形多媒体服务
- 消息和协作
- 网络
- Web服务
通过系统文件函数的操作掌握学习方法:C++调用
例:删除函数API
访问MSDN查看函数用法,调用某个函数,一定要看函数头文件!!!
#include <stdio.h>
#include <Windows.h>
/*删除文件,调用Windows API*/
int main()
{
BOOL a;
char Path_File[] = "C:\\Users\\jhon\\Desktop\\222.txt";
a = DeleteFileA(Path_File);
printf("返回值:%d错误码:%d\n",a,GetLastError());
getchar();
return 0;
}
查看返回系统错误码含义:https://docs.microsoft.com/zh-cn/windows/desktop/Debug/system-error-codes