API接口书写

工作交互中,作为基础组件的部门给其他同事交付的组件,或者前后端对接,或者给第三方交付接口等。其中的一个非常重要的部分就是API文档的书写。

微软家的文档是比较齐全,使用起来是比较幸福的。 下面以showwindow为示例展示一个好的API接口文档应该如何书写,接口文档可以手写,也可以在代码中写好,然后用文档生成工具生成。

参考链接:
https://docs.microsoft.com/zh...

API文档应该有如下的内容

  • 函数原型
  • 参数以及描述
  • 返回值以及描述
  • 使用的注意事项(可选)
  • 使用示例(可选)
  • 使用需求(可选)
  • See also(可选)

示例

Syntax
BOOL ShowWindow(
  HWND hWnd,
  int  nCmdShow
);
Parameters

hWnd
Type: HWND
A handle to the window.

nCmdShow
Type: int
... other descriptions...

Return value

Type: Type: BOOL**

If the window was previously visible, the return value is nonzero.

If the window was previously hidden, the return value is zero.

  • Remarks

To perform certain special effects when showing or hiding a window, use AnimateWindow.
...

Examples

For an example, see Creating a Main Window.

See Aslo

AnimateWindow

评论

暂无评论