SDK:Software Development Kit 软件开发工具包(套件)
API:Application Programming Interface 应用程序接口(操作系统提供的一组功能性函数)
内核对象 :Kernel object 内核对象是系统提供的用户模式下代码与内核模式下代码进行交互的基本接口
句柄 :handle 内核对象的“ID”
Windows程序 :多任务
控制台程序 :单任务
SDK 的入口为 WinMain,必须包含头文件 windows.h
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
return 0;
}
winmain参数:
- hInstance - 实例句柄,主模块句柄
- lpCmdLine - 命令行参数(废弃不用,现在一直为0)
- nCmdShow - 窗口的显示方式
所有的进程高2G都分配到内存条的同一个2G空间中,进程中的内存是隔离的。
int MessageBox(
HWND hWnd, // handle to owner window
LPCTSTR lpText, // text in message box
LPCTSTR lpCaption, // message box title
UINT uType // message box style
);
hWnd [in] Handle to the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window. 需要创建的消息框的父句柄,如果没有父窗口就填NULL
lpText [in] Pointer to a null-terminated string that contains the message to be displayed. 需要显示的字符串以零结尾
lpCaption [in] Pointer to a null-terminated string that contains the dialog box title. If this parameter is NULL, the default title Error is used. 指向对话框标题以零结尾的字符串,填NULL就是使用默认标题error
uType [in] Specifies the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags.填入参数用来自定义
测试代码 :
#include "framework.h"
#include "WindowsProject1.h"
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
MessageBox(NULL, L"hello SDK!", L"测试", MB_OK);
return 0;
}
显示效果: